c - Maintaining a list of programs I don't want Make to compile that I could change with >> and SED instead of editing the makefile? -
i'm pretty new make. current makefile below. compiles .c files respective executable file. list of c files growing (i'm adding more , more files, p1.c, p2.c, p3.c, ...). want compile most of them, if there's particular file has errors don't want bother with, i'd able put on do-not-compile list--that is, instead of telling make do want compile, faster tell don't want compile. easy have file dont.txt add , remove lines to, each of contain "px.c". if had such file, how tell make not compile .c files?
cflags = -g -pedantic -std=c99 -wall srcs = $(wildcard *.c) progs = $(patsubst %.c,%,$(srcs)) all: $(progs) %: %.c $(cc) $(cflags) -o $@ $< thank
you can filter out source files not want compile like
srcs = $(filter-out excludefile.c, $(wildcard *.c)) also if maintain files name want exclude use command follows
for example file exclude.txt then
excludes := $(shell cat ./exclude.txt) srcs = $(filter-out $(excludes), $(wildcard *.c))
Comments
Post a Comment