help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Issue with foreach statement


From: Lee Shallis
Subject: Issue with foreach statement
Date: Mon, 25 Jul 2016 18:47:50 +0100

I don't know whether this is because of the way I used foreach or whether
it is because of the way I used gcc so I'm going to start with the snippet
involving my foreach statement:

CODIT_SRC:=$(sort $(notdir $(wildcard $(CODIT__SRC_DIR)*.c)))
> CODIT_OBJ:=$(CODIT_SRC:.c=.o)
> CODIT_DEP:=$(CODIT_SRC:.c=.d)
> CODIT_OUT:=$(CODIT_TARGETS:=.out)
> CODIT_VMK:=$(CODIT_TARGETS:=.vmk)
>
> # Ensure dependencies are up to date
> define CODIT_GEN_DEP
>     $(eval TMP_SRC=$(CODIT__SRC_DIR)$(subst .d,.c,$(1)))
>     $(eval TMP_DEP=$(CODIT__DEP_DIR)$(1))
>     $(eval TMP_OBJ=$(subst .d,.o,$(1)))
>     $(eval TMP_CFLAGS=$(CODIT_T_CFLAGS) $(CODIT_T_LFLAGS))
>     $(call CC_GEN_DEP,$(TMP_SRC),$(TMP_DEP),$(TMP_OBJ),$(TMP_CFLAGS))
> endef
>
> ifeq ("$(wildcard $(CODIT_DEP_DIR))","")
> $(shell mkdir $(CODIT_DEP_DIR))
> endif
>

$(foreach dependency,$(CODIT_DEP),$(call CODIT_GEN_DEP,$(dependency)))
>

The top half of this snippet was provided only for clarity, it's the last
line that I'm unsure if there is an issue with, if there's not then I will
try at the GCC mailing list. If you need it then here's the breakdown of
the CC_GEN_DEP

MGW64:=C:/tools/mingw64
> MGW64_PREFIX:=x86_64-w64-mingw32
>
... (Ommitted)

> MGW64_BIN_DIR:=$(MGW64)/bin
>
...

> MGW64_CC:="$(MGW64_BIN_DIR)/$(MGW64_PREFIX)-gcc.exe"
> define MGW64_GEN_DEP
>     $(info $(MGW64_CC) $(4) $(1) -MF $(2) -MT $(3) -MM)
>     $(shell $(MGW64_CC) $(4) $(1) -MF $(2) -MT $(3) -MM)
> endef
>
...

> CC_PREFIX=MGW$(HOST_SYS_BIT)
>
...

> # $(call CC_GEN_DEP,$(SRC),$(DEP),$(OBJ),$(CFLAGS))
> define CC_GEN_DEP
>     #(info $(0)=$(CC_PREFIX)_GEN_DEP,$(1),$(2),$(3),$(4))
>     $(call $(CC_PREFIX)_GEN_DEP,$(1),$(2),$(3),$(4))
> endef
>

And then the output:

> "C:/tools/mingw64/bin/x86_64-w64-mingw32-gcc.exe"  src/Codit-BasicMem.c
> -MF src/Codit-BasicMem.d -MT Codit-BasicMem.o -MM
>
... (Omitted)

> "C:/tools/mingw64/bin/x86_64-w64-mingw32-gcc.exe"  src/codit_test.c -MF
> src/codit_test.d -MT codit_test.o -MM
> GNUmakefile:46: *** missing separator.  Stop.
> > ERROR: Command `%make% test` exited with status code 2.
>
The last 2 lines are why I'm trying here first​

-- 
We will die a permanent death unless we trust in Jesus Christ our saviour
and repent our sinful ways


reply via email to

[Prev in Thread] Current Thread [Next in Thread]