diff options
Diffstat (limited to 'tools/niminst')
-rw-r--r-- | tools/niminst/buildsh.tmpl | 2 | ||||
-rw-r--r-- | tools/niminst/makefile.tmpl | 61 | ||||
-rw-r--r-- | tools/niminst/niminst.nim | 2 |
3 files changed, 35 insertions, 30 deletions
diff --git a/tools/niminst/buildsh.tmpl b/tools/niminst/buildsh.tmpl index ec20566ac..3e7d8ae6e 100644 --- a/tools/niminst/buildsh.tmpl +++ b/tools/niminst/buildsh.tmpl @@ -144,6 +144,8 @@ case $ucpu in mycpu="sparc64" fi ;; + *ppc64le* ) + mycpu="powerpc64el" ;; *ppc64* ) if [ "$myos" = "linux" ] ; then COMP_FLAGS="$COMP_FLAGS -m64" diff --git a/tools/niminst/makefile.tmpl b/tools/niminst/makefile.tmpl index 4a20680e0..891333251 100644 --- a/tools/niminst/makefile.tmpl +++ b/tools/niminst/makefile.tmpl @@ -4,10 +4,10 @@ # "# Template is in tools/niminst/makefile.tmpl\n" & # "# To regenerate run ``niminst csource`` or ``koch csource``\n" -CC = gcc -LINKER = gcc -COMP_FLAGS = $(CPPFLAGS) $(CFLAGS) ?{c.ccompiler.flags} -LINK_FLAGS = $(LDFLAGS) ?{c.linker.flags} +CC ??= gcc +LD ??= gcc +CFLAGS += -Ic_code ?{c.ccompiler.flags} +LDFLAGS += ?{c.linker.flags} binDir = ?{firstBinPath(c).toUnix} koch := $(shell sh -c 'test -s ../koch.nim && echo "yes"') @@ -17,63 +17,57 @@ endif ucpu := $(shell sh -c 'uname -m | tr "[:upper:]" "[:lower:]"') uos := $(shell sh -c 'uname | tr "[:upper:]" "[:lower:]"') -uosname := $(shell sh -c 'uname -o | 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 - LINKER = clang - LINK_FLAGS += -lm + LD = clang + 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 - LINKER = clang - LINK_FLAGS += -ldl -lm + LD = clang + 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 endif -ifndef uos +ifndef myos $(error unknown operating system: $(uos)) endif -ifeq ($(uosname),android) - myos = android - LINK_FLAGS += -landroid-glob -endif - ifeq ($(ucpu),i386) mycpu = i386 endif @@ -107,11 +101,14 @@ endif ifeq ($(ucpu),sun) mycpu = sparc endif +ifeq ($(ucpu),ppc64le) + mycpu = powerpc64el +endif ifeq ($(ucpu),ppc64) mycpu = powerpc64 ifeq ($(myos),linux) - COMP_FLAGS += -m64 - LINK_FLAGS += -m64 + CFLAGS += -m64 + LDFLAGS += -m64 endif endif ifeq ($(ucpu),powerpc) @@ -138,7 +135,16 @@ endif ifeq ($(ucpu),armv6l) mycpu = arm endif -ifndef ucpu +ifeq ($(ucpu),armv7l) + mycpu = arm +endif +ifeq ($(ucpu),armv7hl) + mycpu = arm +endif +ifeq ($(ucpu),aarch64) + mycpu = arm64 +endif +ifndef mycpu $(error unknown processor: $(ucpu)) endif @@ -160,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) - $(LINKER) -o $@ $^ $(LINK_FLAGS) + $(LD) -o $@ $^ $(LDFLAGS) @echo "SUCCESS" .PHONY: clean diff --git a/tools/niminst/niminst.nim b/tools/niminst/niminst.nim index e4568dc3a..9c15326b0 100644 --- a/tools/niminst/niminst.nim +++ b/tools/niminst/niminst.nim @@ -283,7 +283,7 @@ proc yesno(p: var CfgParser, v: string): bool = else: quit(errorStr(p, "unknown value; use: yes|no")) proc incl(s: var seq[string], x: string): int = - for i in 0.. <s.len: + for i in 0 ..< s.len: if cmpIgnoreStyle(s[i], x) == 0: return i s.add(x) result = s.len-1 |