3acea4f61d7aa1aebf6c44879d63583aeecbd3cf
Stefan Schuermans expand during assignment

Stefan Schuermans authored 7 years ago

1) CONFIG :=
2) DEFINE :=
Stefan Schuermans makefile support for windows

Stefan Schuermans authored 7 years ago

3) INCLUDE := -Icommon
Stefan Schuermans File + Directory for Windows

Stefan Schuermans authored 7 years ago

4) CFLAGS := -Wall -Wextra -Werror -O2 $(EXTRA_CFLAGS)
5) LDFLAGS := $(EXTRA_LDFLAGS)
6) LIBS := -lBlinkenLib $(EXTRA_LIBS)
Stefan Schuermans makefile support for windows

Stefan Schuermans authored 7 years ago

7) TARGET := Blinker
8) ifeq ($(CROSS_WIN),1)
9) CXX := x86_64-w64-mingw32-g++
10) PLATFORM := windows
11) TARGET := Blinker.exe
12) else
13) CXX := g++
14) PLATFORM := linux
15) endif
16) INCLUDE += -I$(PLATFORM)
Stefan Schuermans expand during assignment

Stefan Schuermans authored 7 years ago

17) 
Stefan Schuermans improve build system

Stefan Schuermans authored 7 years ago

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

Stefan Schuermans authored 7 years ago

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

Stefan Schuermans authored 7 years ago

21) 
Stefan Schuermans makefile support for windows

Stefan Schuermans authored 7 years ago

22) SRCS := $(wildcard common/*.cpp) $(wildcard $(PLATFORM)/*.cpp)
Stefan Schuermans expand during assignment

Stefan Schuermans authored 7 years ago

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

Stefan Schuermans authored 7 years ago

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

Stefan Schuermans authored 13 years ago

26) 
Stefan Schuermans added flexipix output suppo...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 13 years ago

28) .SUFFIXES:
29) .SECONDARY:
30) 
Stefan Schuermans improve auto dependencies

Stefan Schuermans authored 7 years ago

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

Stefan Schuermans authored 13 years ago

32) 
33) ifneq ($(MAKECMDGOALS),clean)
Stefan Schuermans added flexipix output suppo...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 7 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 13 years ago

38) endif
39) 
Stefan Schuermans expand during assignment

Stefan Schuermans authored 7 years ago

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

Stefan Schuermans authored 12 years ago

42) config.mk: $(CFGS_MK)
43) 	cat /dev/null $^ >$@
44) 
45) %.cfg.mk: %.cfg.sh
46) 	sh $< >$@
47) 
Stefan Schuermans improve build system

Stefan Schuermans authored 7 years ago

48) obj:
Stefan Schuermans makefile support for windows

Stefan Schuermans authored 7 years ago

49) 	mkdir $@ $@/common $@/$(PLATFORM)
Stefan Schuermans improve build system

Stefan Schuermans authored 7 years ago

50) 
51) obj/%.d: %.cpp Makefile config.mk | obj
52) 	$(CXX) $(DEFINE) $(INCLUDE) $(CFLAGS) -MM -MT $(@:.d=.o) -o $@ $<
Stefan Schuermans first version, plays videos...

Stefan Schuermans authored 13 years ago

53) 
Stefan Schuermans improve build system

Stefan Schuermans authored 7 years ago

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

Stefan Schuermans authored 7 years ago

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

Stefan Schuermans authored 13 years ago

56) 
57) $(TARGET): $(OBJS)
Stefan Schuermans C++ compiler is CXX

Stefan Schuermans authored 7 years ago

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

Stefan Schuermans authored 13 years ago

59) 
60) clean:
Stefan Schuermans makefile support for windows

Stefan Schuermans authored 7 years ago

61) 	rm -rf obj $(TARGET)
Stefan Schuermans first version, plays videos...

Stefan Schuermans authored 13 years ago

62)