begin removing Makefile boilerplate
This commit is contained in:
parent
e599801f2e
commit
a1e34376de
2 changed files with 19 additions and 15 deletions
26
Makefile
26
Makefile
|
|
@ -19,28 +19,32 @@ $(addprefix $(LIB)/,$1)
|
|||
endef
|
||||
|
||||
# === BUILD TARGETS ===
|
||||
all: $(BUILD) $(BIN) $(call mkbin,pw-test graph sine)
|
||||
all: $(BUILD) $(BIN) $(call mkbin,pw-test graph sine shfx cli)
|
||||
$(BIN)/pw-test: $(call mklib, main.c)
|
||||
$(CCOMPILER) $(CFLAGS) -o $(BUILD)/pw-test.o -c $^
|
||||
$(CLINKER) $(LDFLAGS) -o $@ $(BUILD)/pw-test.o
|
||||
$(CC) $(CFLAGS) -o $(BUILD)/pw-test.o -c $^
|
||||
$(CLD) $(CLDFLAGS) -o $@ $(BUILD)/pw-test.o
|
||||
|
||||
$(BIN)/graph: $(call mklib, graph.c)
|
||||
$(CCOMPILER) $(CFLAGS) -o $(BUILD)/graph.o -c $^
|
||||
$(CLINKER) $(LDFLAGS) -lncurses -o $@ $(BUILD)/graph.o
|
||||
|
||||
$(BIN)/sine: $(call mklib, sine.c)
|
||||
$(CCOMPILER) $(CFLAGS) -o $(BUILD)/sine.o -c $^
|
||||
$(CLINKER) $(LDFLAGS) -lncurses -o $@ $(BUILD)/sine.o
|
||||
$(BIN)/shfx: shfx/main.c
|
||||
$(CC) $(CFLAGS) -o $(BUILD)/shfx.o -c $^
|
||||
$(CLD) $(CLDFLAGS) -lncurses -o $@ $(BUILD)/shfx.o
|
||||
|
||||
$(BIN)/cli: cli/main.c cli/mkpty.c
|
||||
$(CLD) $(CLDFLAGS) -o $@ $(BUILD)/cli.o
|
||||
|
||||
$(BUILD) $(BIN):
|
||||
mkdir -p $@
|
||||
|
||||
$1/%.o: $1/%.c
|
||||
$(foreach dep, $^,
|
||||
$(CC) $(CFLAGS) -o "$(BUILD)/$(basename $(notdir dep)).o" -c $(dep))
|
||||
$(LD) $(LDFLAGS) -o $@ $(addsuffix .o,$(basename $^))
|
||||
|
||||
# === DEVELOPMENT TARGETS ===
|
||||
.PHONY: debug run test
|
||||
debug:
|
||||
$(MAKE) all \
|
||||
CFLAGS="$(CFLAGS) $(CFLAGS_DBG)" \
|
||||
LDFLAGS="$(LDFLAGS) $(LDFLAGS_DBG)"
|
||||
CLDFLAGS="$(CLDFLAGS) $(CLDFLAGS_DBG)"
|
||||
run: debug
|
||||
- command $(BIN)/pw-test
|
||||
test: clean run
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue