diff options
author | Stephen <stephengroat@users.noreply.github.com> | 2017-11-22 12:38:19 -0800 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2017-11-22 21:38:19 +0100 |
commit | 89fa4388574872c3e56e9e5030cdfe4d758d106c (patch) | |
tree | 6da8201c5fe202aeb5ebd106d6d57d8df93253c6 /tools | |
parent | d3394be5559c324da1c6b576d0ae9bfa966698d9 (diff) | |
download | Nim-89fa4388574872c3e56e9e5030cdfe4d758d106c.tar.gz |
use more make conventions (#6789)
* use more make conventions improves compatibility with cross compilation systems * use make implicit rule
Diffstat (limited to 'tools')
-rw-r--r-- | tools/niminst/makefile.tmpl | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/tools/niminst/makefile.tmpl b/tools/niminst/makefile.tmpl index 42a590325..891333251 100644 --- a/tools/niminst/makefile.tmpl +++ b/tools/niminst/makefile.tmpl @@ -6,8 +6,8 @@ CC ??= gcc LD ??= gcc -COMP_FLAGS = $(CPPFLAGS) $(CFLAGS) ?{c.ccompiler.flags} -LINK_FLAGS = $(LDFLAGS) ?{c.linker.flags} +CFLAGS += -Ic_code ?{c.ccompiler.flags} +LDFLAGS += ?{c.linker.flags} binDir = ?{firstBinPath(c).toUnix} koch := $(shell sh -c 'test -s ../koch.nim && echo "yes"') @@ -20,46 +20,46 @@ uos := $(shell sh -c 'uname | tr "[:upper:]" "[:lower:]"') ifeq ($(uos),linux) myos = linux - LINK_FLAGS += -ldl -lm + LDFLAGS += -ldl -lm endif ifeq ($(uos),dragonfly) myos = freebsd - LINK_FLAGS += -lm + LDFLAGS += -lm endif ifeq ($(uos),freebsd) myos= freebsd CC = clang LD = clang - LINK_FLAGS += -lm + LDFLAGS += -lm endif ifeq ($(uos),openbsd) myos = openbsd - LINK_FLAGS += -lm + LDFLAGS += -lm endif ifeq ($(uos),netbsd) myos = netbsd - LINK_FLAGS += -lm + LDFLAGS += -lm endif ifeq ($(uos),darwin) myos = macosx CC = clang LD = clang - LINK_FLAGS += -ldl -lm + LDFLAGS += -ldl -lm ifeq ($(HOSTTYPE),x86_64) ucpu = amd64 endif endif ifeq ($(uos),aix) myos = aix - LINK_FLAGS += -dl -lm + LDFLAGS += -dl -lm endif ifeq ($(uos),solaris) myos = solaris - LINK_FLAGS += -ldl -lm -lsocket -lnsl + LDFLAGS += -ldl -lm -lsocket -lnsl endif ifeq ($(uos),sun) myos = solaris - LINK_FLAGS += -ldl -lm -lsocket -lnsl + LDFLAGS += -ldl -lm -lsocket -lnsl endif ifeq ($(uos),haiku) myos = haiku @@ -107,8 +107,8 @@ endif ifeq ($(ucpu),ppc64) mycpu = powerpc64 ifeq ($(myos),linux) - COMP_FLAGS += -m64 - LINK_FLAGS += -m64 + CFLAGS += -m64 + LDFLAGS += -m64 endif endif ifeq ($(ucpu),powerpc) @@ -166,12 +166,9 @@ ifeq ($(strip $(oFiles)),) $(error no C code generated for: [$(myos): $(mycpu)]) endif -%.o: %.c - $(CC) $(COMP_FLAGS) -Ic_code -c $< -o $@ - ?{"$(binDir)/" & toLowerAscii(c.name)}: $(oFiles) @mkdir -p $(binDir) - $(LD) -o $@ $^ $(LINK_FLAGS) + $(LD) -o $@ $^ $(LDFLAGS) @echo "SUCCESS" .PHONY: clean |