6ce6057f3c6e6da2b2ac2505dc96f597feb1df5f
Stefan Schuermans expand during assignment

Stefan Schuermans authored 7 years ago

1) TARGET := Blinker
2) 
Stefan Schuermans C++ compiler is CXX

Stefan Schuermans authored 7 years ago

3) CXX := g++
Stefan Schuermans expand during assignment

Stefan Schuermans authored 7 years ago

4) CONFIG :=
5) DEFINE :=
6) INCLUDE := -Icommon -Ilinux
Stefan Schuermans improve auto dependencies

Stefan Schuermans authored 7 years ago

7) CFLAGS := -Wall -Wextra -Werror -O2
Stefan Schuermans expand during assignment

Stefan Schuermans authored 7 years ago

8) LDFLAGS :=
9) LIBS := -lBlinkenLib
10) 
Stefan Schuermans improve build system

Stefan Schuermans authored 7 years ago

11) CFGS := $(wildcard config/*.cfg.sh)
Stefan Schuermans expand during assignment

Stefan Schuermans authored 7 years ago

12) CFGS_BASE := $(patsubst %.cfg.sh,%,$(CFGS))
13) CFGS_MK := $(addsuffix .cfg.mk,$(CFGS_BASE))
Stefan Schuermans improve build system

Stefan Schuermans authored 7 years ago

14) 
15) SRCS := $(wildcard common/*.cpp) $(wildcard linux/*.cpp)
Stefan Schuermans expand during assignment

Stefan Schuermans authored 7 years ago

16) SRCS_BASE := $(patsubst %.cpp,%,$(SRCS))
Stefan Schuermans improve build system

Stefan Schuermans authored 7 years ago

17) DEPS := $(addprefix obj/,$(addsuffix .d,$(SRCS_BASE)))
18) OBJS := $(addprefix obj/,$(addsuffix .o,$(SRCS_BASE)))
Stefan Schuermans first version, plays videos...

Stefan Schuermans authored 13 years ago

19) 
Stefan Schuermans added flexipix output suppo...

Stefan Schuermans authored 13 years ago

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

Stefan Schuermans authored 13 years ago

21) .SUFFIXES:
22) .SECONDARY:
23) 
Stefan Schuermans improve auto dependencies

Stefan Schuermans authored 7 years ago

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

Stefan Schuermans authored 13 years ago

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

Stefan Schuermans authored 13 years ago

27)   ifneq ($(MAKECMDGOALS),distclean)
28)     include config.mk
Stefan Schuermans improve auto dependencies

Stefan Schuermans authored 7 years ago

29)     -include $(DEPS)
Stefan Schuermans added flexipix output suppo...

Stefan Schuermans authored 13 years ago

30)   endif
Stefan Schuermans first version, plays videos...

Stefan Schuermans authored 13 years ago

31) endif
32) 
Stefan Schuermans expand during assignment

Stefan Schuermans authored 7 years ago

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

Stefan Schuermans authored 13 years ago

35) config.mk: $(CFGS_MK)
36) 	cat /dev/null $^ >$@
37) 
38) %.cfg.mk: %.cfg.sh
39) 	sh $< >$@
40) 
Stefan Schuermans improve build system

Stefan Schuermans authored 7 years ago

41) obj:
42) 	mkdir $@ $@/common $@/linux
43) 
44) obj/%.d: %.cpp Makefile config.mk | obj
45) 	$(CXX) $(DEFINE) $(INCLUDE) $(CFLAGS) -MM -MT $(@:.d=.o) -o $@ $<
Stefan Schuermans first version, plays videos...

Stefan Schuermans authored 13 years ago

46) 
Stefan Schuermans improve build system

Stefan Schuermans authored 7 years ago

47) obj/%.o: %.cpp Makefile | obj
Stefan Schuermans C++ compiler is CXX

Stefan Schuermans authored 7 years ago

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

Stefan Schuermans authored 13 years ago

49) 
50) $(TARGET): $(OBJS)
Stefan Schuermans C++ compiler is CXX

Stefan Schuermans authored 7 years ago

51) 	$(CXX) $(LDFLAGS) -o $@ $+ $(LIBS)
Stefan Schuermans first version, plays videos...

Stefan Schuermans authored 13 years ago

52) 
53) clean:
Stefan Schuermans improve build system

Stefan Schuermans authored 7 years ago

54) 	rm -f obj $(TARGET)
Stefan Schuermans first version, plays videos...

Stefan Schuermans authored 13 years ago

55)