forked from aburch/simutrans
-
Notifications
You must be signed in to change notification settings - Fork 0
/
common.mk
56 lines (42 loc) · 1.22 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
OBJS := $(patsubst %, $(BUILDDIR)/%.o, $(basename $(SOURCES)))
DEPS := $(OBJS:%.o=%.d)
DIRS := $(sort $(dir $(OBJS)))
# Make build directories
DUMMY := $(shell mkdir -p $(DIRS))
.PHONY: all clean
.SUFFIXES: .rc
ifeq ($(VERBOSE),)
Q = @
else
Q =
endif
all: $(PROGDIR)/$(PROG)
$(PROGDIR)/$(PROG): $(OBJS)
@echo "===> LD $@"
$(Q)$(HOSTCXX) $(OBJS) $(LDFLAGS) $(LIBS) -o $(PROGDIR)/$(PROG)
clean:
@echo "===> Cleaning up"
$(Q)rm -f $(OBJS)
$(Q)rm -f $(DEPS)
$(Q)rm -f $(PROGDIR)/$(PROG)
$(Q)rm -fr $(PROGDIR)/$(PROG).app
-include $(DEPS)
# Silence stale header dependency errors
%.h:
@true
$(BUILDDIR)/%.o: %.mm
@echo "===> Obj-c OSX $<"
$(Q)$(HOSTCXX) $(CXXFLAGS) $(OBJCFLAGS) -c -MMD -o $@ $<
$(BUILDDIR)/%.o: %.m
@echo "===> Obj-c OSX $<"
$(Q)$(HOSTCXX) $(CXXFLAGS) $(OBJCFLAGS) -c -MMD -o $@ $<
$(BUILDDIR)/%.o: %.c
@echo "===> HOSTCC $<"
$(Q)$(HOSTCC) $(CCFLAGS) -c -MMD -o $@ $<
$(BUILDDIR)/%.o: %.cc
@echo "===> HOSTCXX $<"
$(Q)$(HOSTCXX) $(CXXFLAGS) -c -MMD -o $@ $<
$(BUILDDIR)/%.o: %.rc
@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 $< $@