3b9c7cff3045d8d0c0747b6df28c869a6c4c11bd
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 adapt Makefile to build for...

Stefan Schuermans authored 7 years ago

7) LAST_LIBS :=
Stefan Schuermans makefile support for windows

Stefan Schuermans authored 7 years ago

8) TARGET := Blinker
9) ifeq ($(CROSS_WIN),1)
10) CXX := x86_64-w64-mingw32-g++
11) PLATFORM := windows
Stefan Schuermans adapt Makefile to build for...

Stefan Schuermans authored 7 years ago

12) LDFLAGS += -static
13) LAST_LIBS += -lws2_32
Stefan Schuermans makefile support for windows

Stefan Schuermans authored 7 years ago

14) TARGET := Blinker.exe
15) else
16) CXX := g++
17) PLATFORM := linux
18) endif
19) INCLUDE += -I$(PLATFORM)
Stefan Schuermans expand during assignment

Stefan Schuermans authored 7 years ago

20) 
Stefan Schuermans improve build system

Stefan Schuermans authored 7 years ago

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

Stefan Schuermans authored 7 years ago

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

Stefan Schuermans authored 7 years ago

24) 
Stefan Schuermans makefile support for windows

Stefan Schuermans authored 7 years ago

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

Stefan Schuermans authored 7 years ago

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

Stefan Schuermans authored 7 years ago

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

Stefan Schuermans authored 13 years ago

29) 
Stefan Schuermans added flexipix output suppo...

Stefan Schuermans authored 13 years ago

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

Stefan Schuermans authored 13 years ago

31) .SUFFIXES:
32) .SECONDARY:
33) 
Stefan Schuermans improve auto dependencies

Stefan Schuermans authored 7 years ago

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

Stefan Schuermans authored 13 years ago

35) 
36) ifneq ($(MAKECMDGOALS),clean)
Stefan Schuermans added flexipix output suppo...

Stefan Schuermans authored 13 years ago

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

Stefan Schuermans authored 7 years ago

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

Stefan Schuermans authored 13 years ago

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

Stefan Schuermans authored 13 years ago

41) endif
42) 
Stefan Schuermans expand during assignment

Stefan Schuermans authored 7 years ago

43) DEFINE += -DBLINKER_CONFIG="\"$(CONFIG)\""
Stefan Schuermans adapt Makefile to build for...

Stefan Schuermans authored 7 years ago

44) LIBS += $(LAST_LIBS)
Stefan Schuermans expand during assignment

Stefan Schuermans authored 7 years ago

45) 
Stefan Schuermans added flexipix output suppo...

Stefan Schuermans authored 13 years ago

46) config.mk: $(CFGS_MK)
47) 	cat /dev/null $^ >$@
48) 
49) %.cfg.mk: %.cfg.sh
50) 	sh $< >$@
51) 
Stefan Schuermans improve build system

Stefan Schuermans authored 7 years ago

52) obj:
Stefan Schuermans makefile support for windows

Stefan Schuermans authored 7 years ago

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

Stefan Schuermans authored 7 years ago

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

Stefan Schuermans authored 13 years ago

57) 
Stefan Schuermans improve build system

Stefan Schuermans authored 7 years ago

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

Stefan Schuermans authored 7 years ago

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

Stefan Schuermans authored 13 years ago

60) 
61) $(TARGET): $(OBJS)
Stefan Schuermans C++ compiler is CXX

Stefan Schuermans authored 7 years ago

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

Stefan Schuermans authored 13 years ago

63) 
64) clean:
Stefan Schuermans makefile support for windows

Stefan Schuermans authored 7 years ago

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

Stefan Schuermans authored 13 years ago

66)