Confused by make's response

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Confused by make's response

zxuiji
I've got these lines:

> $(info $(foreach src,$(CODIT_SRC),$(call
> PRINT_INC,$(CODIT__SRC_DIR)$(src),$(CODIT_T_DEP_DIR)/$(patsubst
> %.c,%.d,$(src)),$(patsubst %.c,%.o,$(src)))))
> $(eval PRINT_INCLUDES:=$(sort $(PRINT_INCLUDES)))
> $(info $(subst $(space),$(newline),$(foreach
> header,$(PRINT_INCLUDES),$(call HEADER_DEP,$(header)))))
>
That generate this output after being passed relevant information:

> > Running command `%make% test`...
>
> # State src/Codit-BasicMem.c dependencies
> Codit-BasicMem.o: Codit-Fault.h Codit-Basic.h
>
> # State src/Codit-BasicPage.c dependencies
> Codit-BasicPage.o: Codit-Fault.h Codit-Basic.h
>
> # State src/Codit-BasicStr.c dependencies
> Codit-BasicStr.o: Codit-Fault.h Codit-Basic.h stdio.h
>
> # State src/Codit-FileentName.c dependencies
> Codit-FileentName.o: Codit-Filelst.h
>
> # State src/Codit-FilelstNxt.c dependencies
> Codit-FilelstNxt.o: Codit-Filelst.h
>
> # State src/Codit-FilelstOpenShut.c dependencies
> Codit-FilelstOpenShut.o: Codit-Filelst.h
>
> # State src/Codit-FilelstPrepAPI.c dependencies
> Codit-FilelstPrepAPI.o: Codit-Fileobj.h
>
> # State src/Codit-FileobjOpenShut.c dependencies
> Codit-FileobjOpenShut.o: Codit-Fileobj.h
>
> # State src/Codit-FileobjPutGet.c dependencies
> Codit-FileobjPutGet.o: Codit-Fileobj.h
>
> # State src/Codit-ProcentName.c dependencies
> Codit-ProcentName.o: Codit-Proclst.h
>
> # State src/Codit-ProcentPid.c dependencies
> Codit-ProcentPid.o: Codit-Proclst.h
>
> # State src/Codit-ProclstNxt.c dependencies
> Codit-ProclstNxt.o: Codit-Proclst.h
>
> # State src/Codit-ProclstOpenShut.c dependencies
> Codit-ProclstOpenShut.o: Codit-Proclst.h
>
> # State src/Codit-ProclstPrepAPI.c dependencies
> Codit-ProclstPrepAPI.o: Codit-Proclst.h stdio.h
>
> # State src/Codit-ProcobjOpenShut.c dependencies
> Codit-ProcobjOpenShut.o: Codit-Procobj.h
>
> # State src/Codit-ProcobjPutGet.c dependencies
> Codit-ProcobjPutGet.o: Codit-Procobj.h
>
> # State src/Codit-ProcobjRun.c dependencies
> Codit-ProcobjRun.o: Codit-Procobj.h
>
> # State src/codit-ProcentStatus.c dependencies
> codit-ProcentStatus.o: Codit-Proclst.h
>
> # State src/codit_main.c dependencies
> codit_main.o: Codit-Proclst.h
>
> # State src/codit_test.c dependencies
> codit_test.o: Codit-Proclst.h stdio.h
>
> Codit-Basic.h:
> Codit-Fault.h:
> Codit-Filelst.h:
> Codit-Fileobj.h:
> Codit-Proclst.h:
> Codit-Procobj.h:
> stdio.h:
>
But when I remove the info containers like so:

> $(foreach src,$(CODIT_SRC),$(call
> PRINT_INC,$(CODIT__SRC_DIR)$(src),$(CODIT_T_DEP_DIR)/$(patsubst
> %.c,%.d,$(src)),$(patsubst %.c,%.o,$(src))))
> $(eval PRINT_INCLUDES:=$(sort $(PRINT_INCLUDES)))
> $(info $(subst $(space),$(newline),$(foreach
> header,$(PRINT_INCLUDES),$(call HEADER_DEP,$(header)))))
>

$(info $(foreach src,$(CODIT_SRC),$(call
> PRINT_INC,$(CODIT__SRC_DIR)$(src),$(CODIT_T_DEP_DIR)/$(patsubst
> %.c,%.d,$(src)),$(patsubst %.c,%.o,$(src)))))
> $(eval PRINT_INCLUDES:=$(sort $(PRINT_INCLUDES)))
> $(subst $(space),$(newline),$(foreach header,$(PRINT_INCLUDES),$(call
> HEADER_DEP,$(header))))
>
I get this instead:

> > Running command `%make% test`...
> GNUmakefile:133: *** multiple target patterns.  Stop.
>

> Running command `%make% test`...

...(duplicate output omitted)
> GNUmakefile:135: *** target pattern contains no '%'.  Stop.
>

As you can see by the output of the info containers it does not seem like I
should be getting these errors, could someone enlighten me as what I'm
doing wrong as I do not see the fault.

--
We will die a permanent death unless we trust in Jesus Christ our saviour
and repent our sinful ways
_______________________________________________
Help-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-make
Reply | Threaded
Open this post in threaded view
|

Re: Confused by make's response

zxuiji
On 6 August 2016 at 11:55, Lee Shallis <[hidden email]> wrote:

> ​...it does not seem like I should be getting these errors, could someone
> enlighten me as what I'm doing wrong as I do not see the fault.
>

Never mind I found an easier way:
DEP_FILE=$(CODIT_DIR)dependencies.mk

define PRINT_INC_FILTER
$(subst $(hash)include_,,$(filter $(hash)include_%,$(subst
$(space)$(1),_,$(subst $(2),,$(3)))))
endef

PRINT_INCLUDES=

define PRINT_INC
$(strip
$(eval $(0)_SRC=$(call FILE_FULL_RD,$(1)))
$(eval $(0)_REMOTE=$(call PRINT_INC_FILTER,$(openc),$(shutc),$($(0)_SRC)))
$(eval $(0)_WSPACE=$(call PRINT_INC_FILTER,$(quote),$(quote),$($(0)_SRC)))
$(eval $(0)_SRC=0)
$(eval $(0)LUDES+=$($(0)_REMOTE) $($(0)_WSPACE))
$(shell >>$(DEP_FILE) echo $(hash) State $(1) dependencies)
$(shell >>$(DEP_FILE) echo $(2): $($(0)_REMOTE) $($(0)_WSPACE))
)
endef

$(shell >$(DEP_FILE) echo $(hash) DO NOT MODIFY! Generated on the fly)
$(foreach src,$(CODIT_SRC),$(call
PRINT_INC,$(CODIT__SRC_DIR)$(src),$(patsubst %.c,%.o,$(src))))
$(eval PRINT_INCLUDES:=$(sort $(PRINT_INCLUDES)))
$(foreach header,$(PRINT_INCLUDES),$(shell >>$(DEP_FILE) echo
$(header)$(colon)))
#$(info $(hash) Begin compiling dependencies)
#$(eval $(foreach codit_d,$(CODIT_DEP),$(call CODIT_GEN_DEP,$(codit_d),.c)))
include $(DEP_FILE)​

--
We will die a permanent death unless we trust in Jesus Christ our saviour
and repent our sinful ways
_______________________________________________
Help-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-make