-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
38 lines (29 loc) · 970 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
.PHONY: all clean
SRC := src
BUILD := bin
HEADERS := $(wildcard $(SRC)/*.h)
OBJECTS := $(foreach EXT,cpp sh,$(patsubst $(SRC)/%.$(EXT),$(BUILD)/%,$(wildcard $(SRC)/*.$(EXT))))
OBJECTS := $(filter-out $(BUILD)/float,$(OBJECTS))
OBJECTS += $(foreach N,$(shell seq 1 10),$(BUILD)/float$N)
CXXFLAGS := -std=c++11 -O2 -march=native -mfpmath=sse -pipe
CXXFLAGS += -Wall -Wextra -pedantic -Wformat=2 -Wfloat-equal -Wlogical-op -Wredundant-decls
CXXFLAGS += -Wconversion -Wcast-qual -Wcast-align -Wuseless-cast -Wno-unused-local-typedefs
define abbrev
@echo $1 ...
@$1 $2
endef
all: $(OBJECTS) $(BUILD)/ok
$(BUILD)/%: $(SRC)/%.cpp $(HEADERS)
@mkdir -p $(@D)
$(call abbrev,$(CXX) $< -o $@,$(CXXFLAGS))
$(BUILD)/float%: $(SRC)/float.cpp $(HEADERS)
@mkdir -p $(@D)
$(call abbrev,$(CXX) $< -o $@ -DPREC=$*,$(CXXFLAGS))
$(BUILD)/%: $(SRC)/%.sh
@mkdir -p $(@D)
ln -sf ../$< $@
$(BUILD)/ok: $(shell which true)
@mkdir -p $(@D)
ln -sf $< $@
clean:
rm -rf $(BUILD)