-
Notifications
You must be signed in to change notification settings - Fork 171
/
uncommon.mk
63 lines (48 loc) · 1.6 KB
/
uncommon.mk
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#
# This file is part of the Simutrans project under the Artistic License.
# (see LICENSE.txt)
#
# Source files located in ../
OBJS := $(patsubst %, $(BUILDDIR)/%-$(TOOL).o, $(basename $(patsubst ../simutrans/%, %,$(filter ../simutrans/%,$(SOURCES)))))
# Source files located in current directory
OBJS += $(patsubst %, $(BUILDDIR)/$(TOOL)/%-$(TOOL).o, $(basename $(filter-out ../simutrans/%,$(SOURCES))))
DEPS := $(patsubst %.o, %.d, $(OBJS))
DIRS := $(sort $(dir $(OBJS)))
BUILDCONFIG_FILES := ../../uncommon.mk Makefile ../../config.$(CFG)
# Make build directories
DUMMY := $(shell mkdir -p $(DIRS))
.PHONY: all clean clean-prog
ifeq ($(VERBOSE),)
Q = @
else
Q =
endif
all: $(TOOL_PROGDIR)/$(PROG)
$(TOOL_PROGDIR)/$(PROG): $(OBJS)
@echo "===> LD $@"
$(Q)$(CXX) $(OBJS) $(LDFLAGS) $(STD_LIBS) $(LIBS) -o $(TOOL_PROGDIR)/$(PROG)
clean-prog:
$(Q)rm -f $(TOOL_PROGDIR)/$(PROG)
clean:
@echo "===> Cleaning up"
$(Q)rm -f $(OBJS)
$(Q)rm -f $(DEPS)
$(Q)rm -f $(TOOL_PROGDIR)/$(PROG)
-include $(DEPS)
# Silence stale header dependency errors
%.h:
@true
# Source files located in ../
$(BUILDDIR)/%-$(TOOL).o: ../simutrans/%.cc $(BUILDCONFIG_FILES)
@echo "===> CC $<"
$(Q)$(CC) $(CCFLAGS) -c -MMD -o $@ $<
$(BUILDDIR)/%-$(TOOL).o: ../simutrans/%.cc $(BUILDCONFIG_FILES)
@echo "===> CXX $<"
$(Q)$(CXX) $(CXXFLAGS) -c -MMD -o $@ $<
# Source files located in current directory
$(BUILDDIR)/$(TOOL)/%-$(TOOL).o: %.c $(BUILDCONFIG_FILES)
@echo "===> CC $<"
$(Q)$(CC) $(CCFLAGS) -c -MMD -o $@ $<
$(BUILDDIR)/$(TOOL)/%-$(TOOL).o: %.cc $(BUILDCONFIG_FILES)
@echo "===> CXX $<"
$(Q)$(CXX) $(CXXFLAGS) -c -MMD -o $@ $<