mirror of
https://github.com/rbenv/rbenv.git
synced 2024-12-28 20:55:38 +01:00
Create configure
script to generate a cross-platform Makefile
The previous Makefile only worked on OS X. The dynamically generated Makefile (from `Makefile.in`) should now work on multiple platforms (tested on OS X and Ubuntu).
This commit is contained in:
parent
302b317b89
commit
a6e0785b84
5 changed files with 66 additions and 10 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -5,4 +5,5 @@
|
|||
/sources
|
||||
/cache
|
||||
/libexec/*.dylib
|
||||
/src/Makefile
|
||||
/src/*.o
|
||||
|
|
10
src/Makefile
10
src/Makefile
|
@ -1,10 +0,0 @@
|
|||
SHOBJ_LDFLAGS = -dynamiclib
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
../libexec/rbenv-realpath.dylib: realpath.o
|
||||
$(CC) $(CFLAGS) $(SHOBJ_LDFLAGS) -o $@ realpath.o
|
||||
|
||||
clean:
|
||||
rm -f *.o ../libexec/*.dylib
|
25
src/Makefile.in
Normal file
25
src/Makefile.in
Normal file
|
@ -0,0 +1,25 @@
|
|||
CC = @CC@
|
||||
|
||||
CFLAGS = @CFLAGS@
|
||||
LOCAL_CFLAGS = @LOCAL_CFLAGS@
|
||||
DEFS = @DEFS@
|
||||
LOCAL_DEFS = @LOCAL_DEFS@
|
||||
|
||||
CCFLAGS = $(DEFS) $(LOCAL_DEFS) $(LOCAL_CFLAGS) $(CFLAGS)
|
||||
|
||||
SHOBJ_CC = @SHOBJ_CC@
|
||||
SHOBJ_CFLAGS = @SHOBJ_CFLAGS@
|
||||
SHOBJ_LD = @SHOBJ_LD@
|
||||
SHOBJ_LDFLAGS = @SHOBJ_LDFLAGS@
|
||||
SHOBJ_XLDFLAGS = @SHOBJ_XLDFLAGS@
|
||||
SHOBJ_LIBS = @SHOBJ_LIBS@
|
||||
SHOBJ_STATUS = @SHOBJ_STATUS@
|
||||
|
||||
.c.o:
|
||||
$(SHOBJ_CC) $(SHOBJ_CFLAGS) $(CCFLAGS) -c -o $@ $<
|
||||
|
||||
../libexec/rbenv-realpath.dylib: realpath.o
|
||||
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ realpath.o $(SHOBJ_LIBS)
|
||||
|
||||
clean:
|
||||
rm -f *.o ../libexec/*.dylib
|
39
src/configure
vendored
Executable file
39
src/configure
vendored
Executable file
|
@ -0,0 +1,39 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
src_dir="${0%/*}"
|
||||
|
||||
CC="${CC:-gcc}"
|
||||
|
||||
if ! which "$CC" &>/dev/null; then
|
||||
echo "no compiler found: $CC" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case "$(uname -s)" in
|
||||
Darwin* )
|
||||
host_os="darwin$(uname -r)"
|
||||
;;
|
||||
OpenBSD* )
|
||||
host_os="openbsd$(uname -r)"
|
||||
;;
|
||||
* )
|
||||
host_os="linux-gnu"
|
||||
esac
|
||||
|
||||
eval "$("$src_dir"/shobj-conf -C "$CC" -o "$host_os")"
|
||||
|
||||
sed "
|
||||
s,@CC@,${CC},
|
||||
s,@CFLAGS@,${CFLAGS},
|
||||
s,@LOCAL_CFLAGS@,${LOCAL_CFLAGS},
|
||||
s,@DEFS@,${DEFS},
|
||||
s,@LOCAL_DEFS@,${LOCAL_DEFS},
|
||||
s,@SHOBJ_CC@,${SHOBJ_CC},
|
||||
s,@SHOBJ_CFLAGS@,${SHOBJ_CFLAGS},
|
||||
s,@SHOBJ_LD@,${SHOBJ_LD},
|
||||
s,@SHOBJ_LDFLAGS@,${SHOBJ_LDFLAGS//,/\,},
|
||||
s,@SHOBJ_XLDFLAGS@,${SHOBJ_XLDFLAGS//,/\,},
|
||||
s,@SHOBJ_LIBS@,${SHOBJ_LIBS},
|
||||
s,@SHOBJ_STATUS@,${SHOBJ_STATUS},
|
||||
" "$src_dir"/Makefile.in > "$src_dir"/Makefile
|
1
test/run
1
test/run
|
@ -2,6 +2,7 @@
|
|||
set -e
|
||||
|
||||
if [ -n "$RBENV_NATIVE_EXT" ]; then
|
||||
src/configure
|
||||
make -C src
|
||||
fi
|
||||
|
||||
|
|
Loading…
Reference in a new issue