forked from aburch/simutrans
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon.mk
54 lines (40 loc) · 1.05 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
DEPS := $(patsubst %, $(BUILDDIR)/%.d, $(basename $(filter-out %.rc, $(SOURCES))))
OBJS := $(patsubst %, $(BUILDDIR)/%.o, $(basename $(SOURCES)))
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)$(CXX) $(OBJS) $(LDFLAGS) $(LIBS) -o $(PROGDIR)/$(PROG)
clean:
@echo "===> Cleaning up"
$(Q)rm -f $(OBJS)
$(Q)rm -f $(DEPS)
$(Q)rm -f $(PROGDIR)/$(PROG)
-include $(DEPS)
# Silence stale header dependency errors
%.h:
@true
$(BUILDDIR)/%.o: %.mm
@echo "===> Obj-c OSX $<"
$(Q)$(CXX) $(CXXFLAGS) $(OBJCFLAGS) -c -MMD -o $@ $<
$(BUILDDIR)/%.o: %.m
@echo "===> Obj-c OSX $<"
$(Q)$(CXX) $(CXXFLAGS) $(OBJCFLAGS) -c -MMD -o $@ $<
$(BUILDDIR)/%.o: %.c
@echo "===> CC $<"
$(Q)$(CC) $(CCFLAGS) -c -MMD -o $@ $<
$(BUILDDIR)/%.o: %.cc
@echo "===> CXX $<"
$(Q)$(CXX) $(CXXFLAGS) -c -MMD -o $@ $<
$(BUILDDIR)/%.o: %.rc
@echo "===> RES $<"
$(Q)$(WINDRES) -O COFF $< $@