-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
47 lines (35 loc) · 992 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
39
40
41
42
43
44
45
46
47
OUT = build
getfiles = \
$(foreach d,$(wildcard $1/*),$(call getfiles,$d,$2) $(filter $2,$d))
SRCS = \
$(call getfiles,src,%.cc)
CXXFLAGS += \
-std=c++2a -Wall -Wextra -Wno-missing-field-initializers -Wpedantic \
-Igroufix/include -Isrc
LDFLAGS += -L$(OUT) -Wl,-rpath,'$$ORIGIN'
LDLIBS += -lgroufix
OBJS = $(patsubst %,$(OUT)/%.o,$(SRCS))
DEPS = $(patsubst %,$(OUT)/%.d,$(SRCS))
$(OUT)/fiezta: $(OUT)/libgroufix.so $(OBJS)
@mkdir -p $(@D)
$(CXX) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)
$(OUT)/libgroufix.so:
@mkdir -p $(@D)
$(MAKE) -C groufix unix
cp groufix/bin/unix/libgroufix.so $@
@# TODO: Make this cross-platform
#install_name_tool -id '@executable_path/libgroufix.so' $@
$(OUT)/%.cc.o: %.cc
@mkdir -p $(@D)
$(CXX) -MMD $(CXXFLAGS) -o $@ -c $<
$(OUT)/%.cc.d: $(OUT)/%.cc.o
.PHONY: clean
clean:
rm -rf $(OUT)
.PHONY: clean-groufix
clean-groufix:
$(MAKE) -C groufix clean
rm -f $(OUT)/libgroufix.so
.PHONY: clean-all
clean-all: clean clean-groufix
-include $(DEPS)