forked from rbenv/rbenv
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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).
- Loading branch information
Showing
5 changed files
with
66 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,5 @@ | |
/sources | ||
/cache | ||
/libexec/*.dylib | ||
/src/Makefile | ||
/src/*.o |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
set -e | ||
|
||
if [ -n "$RBENV_NATIVE_EXT" ]; then | ||
src/configure | ||
make -C src | ||
fi | ||
|
||
|