Skip to content

Commit d56cefe

Browse files
committed
Replace gcc by $(CC) in Makefiles
Some Makefiles were using gcc instead of $(CC), fix this to allow cross-compilation Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
1 parent a776f86 commit d56cefe

7 files changed

Lines changed: 21 additions & 8 deletions

File tree

AUTHORS.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ and agreed to irrevocably license their contributions under the Duktape
4848
* \J. McC. (https://github.com/jmhmccr)
4949
* Jakub Nowakowski (https://github.com/jimvonmoon)
5050
* Tommy Nguyen (https://github.com/tn0502)
51+
* Fabrice Fontaine (https://github.com/ffontaine)
5152

5253
Other contributions
5354
===================

dist-files/Makefile.codepage

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
CC = gcc
2+
13
codepage:
2-
gcc -o $@ -std=c99 -O2 -Wall -Wextra -Isrc/ \
4+
$(CC) -o $@ -std=c99 -O2 -Wall -Wextra -Isrc/ \
35
src/duktape.c examples/codepage-conv/duk_codepage_conv.c \
46
examples/codepage-conv/test.c -lm

dist-files/Makefile.eval

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# Example Makefile for building the eval example
33
#
44

5+
CC = gcc
6+
57
eval:
6-
gcc -o $@ -std=c99 -O2 -Wall -Wextra -Isrc/ \
8+
$(CC) -o $@ -std=c99 -O2 -Wall -Wextra -Isrc/ \
79
src/duktape.c examples/eval/eval.c -lm

dist-files/Makefile.eventloop

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22
# Example Makefile for building the eventloop example
33
#
44

5+
CC = gcc
6+
57
evloop:
68
@echo "NOTE: The eventloop is example is intended to be used on Linux"
79
@echo " or other common UNIX variants. It is not fully portable."
810
@echo ""
911

10-
gcc -o $@ -std=c99 -Wall -Wextra -O2 -Isrc \
12+
$(CC) -o $@ -std=c99 -Wall -Wextra -O2 -Isrc \
1113
examples/eventloop/main.c \
1214
examples/eventloop/c_eventloop.c \
1315
examples/eventloop/poll.c \

dist-files/Makefile.jxpretty

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
# Example Makefile for building the jxpretty example
33
#
44

5+
CC = gcc
6+
57
jxpretty:
6-
gcc -o $@ -std=c99 -Wall -Wextra -O2 -Isrc \
8+
$(CC) -o $@ -std=c99 -Wall -Wextra -O2 -Isrc \
79
src/duktape.c examples/jxpretty/jxpretty.c \
810
-lm

dist-files/Makefile.sandbox

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# Example Makefile for building the sandbox example
33
#
44

5+
CC = gcc
6+
57
sandbox:
6-
gcc -o $@ -std=c99 -O2 -Wall -Wextra -Isrc/ \
8+
$(CC) -o $@ -std=c99 -O2 -Wall -Wextra -Isrc/ \
79
src/duktape.c examples/sandbox/sandbox.c -lm

dist-files/Makefile.sharedlibrary

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ INSTALL_PREFIX=/usr/local
3636
DUKTAPE_SRCDIR=./src
3737
#DUKTAPE_SRCDIR=./src-noline
3838

39+
CC=gcc
40+
3941
.PHONY: all
4042
all: libduktape.so.$(REAL_VERSION) libduktaped.so.$(REAL_VERSION)
4143

@@ -44,11 +46,11 @@ all: libduktape.so.$(REAL_VERSION) libduktaped.so.$(REAL_VERSION)
4446
# to $INSTALL_PREFIX/include on installation.
4547

4648
libduktape.so.$(REAL_VERSION):
47-
gcc -shared -fPIC -Wall -Wextra -Os -Wl,-soname,libduktape.so.$(SONAME_VERSION) \
49+
$(CC) -shared -fPIC -Wall -Wextra -Os -Wl,-soname,libduktape.so.$(SONAME_VERSION) \
4850
-o $@ $(DUKTAPE_SRCDIR)/duktape.c
4951

5052
libduktaped.so.$(REAL_VERSION):
51-
gcc -shared -fPIC -g -Wall -Wextra -Os -Wl,-soname,libduktaped.so.$(SONAME_VERSION) \
53+
$(CC) -shared -fPIC -g -Wall -Wextra -Os -Wl,-soname,libduktaped.so.$(SONAME_VERSION) \
5254
-o $@ $(DUKTAPE_SRCDIR)/duktape.c
5355

5456
# Symlinks depend on platform conventions.
@@ -68,4 +70,4 @@ install: libduktape.so.$(REAL_VERSION) libduktaped.so.$(REAL_VERSION)
6870
#CCOPTS=-I/usr/local/include -L/usr/local/lib
6971
CCOPTS=-I./examples/cmdline
7072
duk:
71-
gcc $(CCOPTS) -Wall -Wextra -Os -o $@ ./examples/cmdline/duk_cmdline.c -lduktape -lm
73+
$(CC) $(CCOPTS) -Wall -Wextra -Os -o $@ ./examples/cmdline/duk_cmdline.c -lduktape -lm

0 commit comments

Comments
 (0)