Stefan Schuermans
C++ compiler is CXX
Stefan Schuermans commited f83a288 at 2017-09-23 12:33:58
CFGS := $(wildcard config/*.cfg.sh)
SRCS := $(wildcard common/*.cpp) $(wildcard linux/*.cpp)
TARGET := Blinker
CXX := g++
CONFIG :=
DEFINE :=
INCLUDE := -Icommon -Ilinux
CFLAGS := -Wall -Wextra -Werror -O2
LDFLAGS :=
LIBS := -lBlinkenLib
CFGS_BASE := $(patsubst %.cfg.sh,%,$(CFGS))
CFGS_MK := $(addsuffix .cfg.mk,$(CFGS_BASE))
SRCS_BASE := $(patsubst %.cpp,%,$(SRCS))
DEPS := $(addsuffix .d,$(SRCS_BASE))
OBJS := $(addsuffix .o,$(SRCS_BASE))
.PHONY: all clean distclean
.SUFFIXES:
.SECONDARY:
all: $(DEPS) $(TARGET)
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(MAKECMDGOALS),distclean)
include config.mk
-include $(DEPS)
endif
endif
DEFINE += -DBLINKER_CONFIG="\"$(CONFIG)\""
config.mk: $(CFGS_MK)
cat /dev/null $^ >$@
%.cfg.mk: %.cfg.sh
sh $< >$@
%.d: %.cpp Makefile config.mk
$(CXX) $(DEFINE) $(INCLUDE) $(CFLAGS) -MM -MF $@ -MT $(@:.d=.o) $<
%.o: %.cpp Makefile
$(CXX) $(DEFINE) $(INCLUDE) $(CFLAGS) -c -o $@ $<
$(TARGET): $(OBJS)
$(CXX) $(LDFLAGS) -o $@ $+ $(LIBS)
clean:
rm -f $(DEPS) $(OBJS) $(TARGET)
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX