d0d80ecd6d7c465ca2539a7ce6dd4cb3b765e8e3
Stefan Schuermans expand during assignment

Stefan Schuermans authored 7 years ago

1) CFGS := $(wildcard config/*.cfg.sh)
2) SRCS := $(wildcard common/*.cpp) $(wildcard linux/*.cpp)
3) TARGET := Blinker
4) 
5) CPP := g++
6) CONFIG :=
7) DEFINE :=
8) INCLUDE := -Icommon -Ilinux
9) CFLAGS := -Wall -Wextra -Werror -O2 -g2
10) LDFLAGS :=
11) LIBS := -lBlinkenLib
12) 
13) CFGS_BASE := $(patsubst %.cfg.sh,%,$(CFGS))
14) CFGS_MK := $(addsuffix .cfg.mk,$(CFGS_BASE))
15) SRCS_BASE := $(patsubst %.cpp,%,$(SRCS))
16) DEPS := $(addsuffix .d,$(SRCS_BASE))
17) OBJS := $(addsuffix .o,$(SRCS_BASE))
Stefan Schuermans first version, plays videos...

Stefan Schuermans authored 13 years ago

18) 
Stefan Schuermans added flexipix output suppo...

Stefan Schuermans authored 12 years ago

19) .PHONY: all clean distclean
Stefan Schuermans first version, plays videos...

Stefan Schuermans authored 13 years ago

20) .SUFFIXES:
21) .SECONDARY:
22) 
Stefan Schuermans added flexipix output suppo...

Stefan Schuermans authored 12 years ago

23) all: $(TARGET)
Stefan Schuermans first version, plays videos...

Stefan Schuermans authored 13 years ago

24) 
25) ifneq ($(MAKECMDGOALS),clean)
Stefan Schuermans added flexipix output suppo...

Stefan Schuermans authored 12 years ago

26)   ifneq ($(MAKECMDGOALS),distclean)
27)     include config.mk
28)     include deps
29)   endif
Stefan Schuermans first version, plays videos...

Stefan Schuermans authored 13 years ago

30) endif
31) 
Stefan Schuermans expand during assignment

Stefan Schuermans authored 7 years ago

32) DEFINE += -DBLINKER_CONFIG="\"$(CONFIG)\""
33) 
Stefan Schuermans added flexipix output suppo...

Stefan Schuermans authored 12 years ago

34) config.mk: $(CFGS_MK)
35) 	cat /dev/null $^ >$@
36) 
37) %.cfg.mk: %.cfg.sh
38) 	sh $< >$@
39) 
Stefan Schuermans first version, plays videos...

Stefan Schuermans authored 13 years ago

40) deps: $(DEPS)
Stefan Schuermans added flexipix output suppo...

Stefan Schuermans authored 12 years ago

41) 	cat /dev/null $^ >$@
Stefan Schuermans first version, plays videos...

Stefan Schuermans authored 13 years ago

42) 
Stefan Schuermans added flexipix output suppo...

Stefan Schuermans authored 12 years ago

43) %.d: %.cpp Makefile config.mk
44) 	$(CPP) $(DEFINE) $(INCLUDE) $(CFLAGS) -M -o $@ $<
Stefan Schuermans first version, plays videos...

Stefan Schuermans authored 13 years ago

45) 	sed -i 1s!^!$(dir $<)! $@
46) 
47) %.o: %.cpp Makefile
Stefan Schuermans added flexipix output suppo...

Stefan Schuermans authored 12 years ago

48) 	$(CPP) $(DEFINE) $(INCLUDE) $(CFLAGS) -c -o $@ $<
Stefan Schuermans first version, plays videos...

Stefan Schuermans authored 13 years ago

49) 
50) $(TARGET): $(OBJS)
51) 	$(CPP) $(LDFLAGS) -o $@ $+ $(LIBS)
52) 
53) clean:
54) 	rm -f deps $(DEPS) $(OBJS) $(TARGET)
55)