-
Notifications
You must be signed in to change notification settings - Fork 171
/
common.mk
56 lines (41 loc) · 1.34 KB
/
common.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
#
# This file is part of the Simutrans project under the Artistic License.
# (see LICENSE.txt)
#
OBJS := $(patsubst %, $(BUILDDIR)/%.o, $(basename $(SOURCES)))
DEPS := $(OBJS:%.o=%.d)
DIRS := $(sort $(dir $(OBJS)))
# Make build directories
DUMMY := $(shell mkdir -p $(DIRS))
BUILDCONFIG_FILES := common.mk Makefile config.$(CFG)
.PHONY: all clean
.SUFFIXES: .rc
ifeq ($(VERBOSE),)
Q := @
else
Q :=
endif
simutrans: $(PROGDIR)/$(PROG)
$(PROGDIR)/$(PROG): $(OBJS)
@echo "===> LD $@"
$(Q)$(HOSTCXX) $(OBJS) $(LDFLAGS) $(LIBS) -o $(PROGDIR)/$(PROG)
-include $(DEPS)
# Silence stale header dependency errors
%.h:
@true
$(BUILDDIR)/%.o: %.mm $(BUILDCONFIG_FILES)
@echo "===> Obj-c OSX $<"
$(Q)$(HOSTCXX) $(CXXFLAGS) $(OBJCFLAGS) -c -MMD -o $@ $<
$(BUILDDIR)/%.o: %.m $(BUILDCONFIG_FILES)
@echo "===> Obj-c OSX $<"
$(Q)$(HOSTCXX) $(CXXFLAGS) $(OBJCFLAGS) -c -MMD -o $@ $<
$(BUILDDIR)/%.o: %.c $(BUILDCONFIG_FILES)
@echo "===> HOSTCC $<"
$(Q)$(HOSTCC) $(CCFLAGS) -c -MMD -o $@ $<
$(BUILDDIR)/%.o: %.cc $(BUILDCONFIG_FILES)
@echo "===> HOSTCXX $<"
$(Q)$(HOSTCXX) $(CXXFLAGS) -c -MMD -o $@ $<
$(BUILDDIR)/%.o: %.rc $(BUILDCONFIG_FILES)
@echo "===> RES $<"
# $(Q)$(WINDRES) --preprocessor "$(HOSTCXX) -E -xc -DRC_INVOKED -MMD -MF $(@:%.o=%.d) -MT $@" -O COFF $< $@
$(Q)$(WINDRES) --preprocessor "$(HOSTCXX) -E -xc -DRC_INVOKED -MMD -MT $@" -O COFF $< $@