Makefile: Filter out strings containing a character
Does the following function meet the purpose? FILTER_OUT = $(foreach v,$(2),$(if $(findstring $(1),$(v)),,$(v))) $(call FILTER_OUT,g, seven eight nine ten)
Does the following function meet the purpose? FILTER_OUT = $(foreach v,$(2),$(if $(findstring $(1),$(v)),,$(v))) $(call FILTER_OUT,g, seven eight nine ten)
In short, Ninja parses faster, and has built-in features that reduce the amount to parse. From the philosophical overview in the ninja manual: Where other build systems are high-level languages, Ninja aims to be an assembler. Ninja files are often “compiled” from other makefiles, making it a two-step process whereas Make is a single step. … Read more
Like the OP (James Leonard), I would like to suppress or avoid warnings about overriding Makefile targets. However, my situation and goals are different. I want Makefile to include base.mk, and I want Makefile to be able to override targets from base.mk without any warning messages. I am using GNU Make. The GNU Make documentation … Read more
Use the shell function to execute the cygpath utility with the -w flag. Example: BAR := /cygdrive/c/foo/bar WIN_BAR := $(shell cygpath -w ${BAR}) cygpath accepts a lot of additional options. See the man page for details.
As Greenflow mentioned, Qt Creator can import existing project but it doesn’t even depend on the existence of the Makefile. All you need to do for import of the existing project is specify the high-level folder in which the sources of the project are located (including sources in subdirectories) and set some name for the … Read more
My preference is for release: $(MAKE) clean $(MAKE) test1 This forces the two targets to be made consecutively without disturbing their inner parallelism (if any).
Since you’re using GNU Make, you can make the following adjustment to your Makefile: .PRECIOUS: $(BUILD)/%.pp # ADD THIS LINE $(BUILD)/%.pp: %.c $(ECHO) “PreProcess $<” $(Q)$(CC) $(CFLAGS) -E -Wp,-C,-dD,-dI -o $@ $< The documentation has this to say about .PRECIOUS directives: The targets which .PRECIOUS depends on are given the following special treatment: if make … Read more
If you run: make this program will look for a file named makefile in your directory, and then execute it. If you have several makefiles, then you can execute them with the command: make -f MyMakefile
from the documentation https://www.gnu.org/software/make/manual/make.html#Splitting-Lines Makefiles use a “line-based” syntax in which the newline character is special and marks the end of a statement. GNU make has no limit on the length of a statement line, up to the amount of memory in your computer. However, it is difficult to read lines which are too long … Read more
I realize this is a bit old at this point, but you don’t need to even use a subshell to test if a file exists in Make. It also depends on how you want/expect it to run. Using the wildcard function, like so: all: foo foo: ifeq (,$(wildcard /opt/local/bin/gsort)) $(error GNU Sort does not exist!) … Read more