support for Nim {.compile.} pragma for C sources

Inject bundled C files into build recipes with the Nim {.compile.}
pragma.

Fix #2516
This commit is contained in:
Emery Hemingway 2017-09-06 09:43:48 -05:00 committed by Christian Helmuth
parent 9b8228d76f
commit b20b14de27

View File

@ -109,7 +109,7 @@ NIM_ARGS += $(NIM_OPT)
$(MSG_BUILD)$(basename $@).cpp
$(VERBOSE) rm -f stdlib_*.cpp
$(VERBOSE)$(NIM) compileToCpp $(NIM_ARGS) $<
$(VERBOSE)$(JQ) --raw-output '"SRC_O_NIM +=" + (.link | join(" ")) +"\n" + (.compile | map((.[0] | sub("cpp$$";"o: ")) + .[0] + "\n\t"+(.[1] | sub("^g\\++";"$$(MSG_COMP)$$@\n\t$$(VERBOSE)$$(NIM_CC)"))) | join("\n"))' < $(basename $(basename $@)).json > $@
$(VERBOSE)$(JQ) --raw-output '"SRC_O_NIM +=" + (.link | join(" ")) +"\n" + (.compile | map((.[0] | sub("cpp$$";"o: ") | sub("c$$";"o: ")) + .[0] + "\n\t"+(.[1] | sub("^g\\++";"$$(MSG_COMP)$$@\n\t$$(VERBOSE)$$(NIM_CC)"))) | join("\n"))' < $(basename $(basename $@)).json > $@
NIM_CC := $(CXX) $(CXX_DEF) $(CC_CXX_OPT) $(INCLUDES) -D__GENODE__