forked from bosim/BasicFMC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
108 lines (86 loc) · 3.36 KB
/
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# Makefile for BasicFMC (based on ExampleGauge code from Sandy Barbour
BUILDDIR := ./build
SRC_BASE := ./src
SDK_BASE := ./SDK
TARGET := BasicFMC
SOURCES = \
Bitmap.cpp \
Page.cpp \
Page_Init.cpp \
Page_Legs.cpp \
Page_Airport.cpp \
Page_Progress.cpp \
Page_Route.cpp \
Page_Navaid.cpp \
Pages.cpp \
InputHandler.cpp \
Utils.cpp \
ProcedureReader.cpp \
FreeNavProcedureReader.cpp \
GNSProcedureReader.cpp \
Main.cpp
LIBS =
INCLUDES = \
-I$(SDK_BASE)/CHeaders/XPLM \
-I$(SDK_BASE)/CHeaders/Widgets
DEFINES = -DAPL=0 -DIBM=0 -DLIN=1 -DXPLM200 -ggdb
VPATH = $(SRC_BASE)
CSOURCES := $(filter %.c, $(SOURCES))
CXXSOURCES := $(filter %.cpp, $(SOURCES))
CDEPS := $(patsubst %.c, $(BUILDDIR)/obj32/%.cdep, $(CSOURCES))
CXXDEPS := $(patsubst %.cpp, $(BUILDDIR)/obj32/%.cppdep, $(CXXSOURCES))
COBJECTS := $(patsubst %.c, $(BUILDDIR)/obj32/%.o, $(CSOURCES))
CXXOBJECTS := $(patsubst %.cpp, $(BUILDDIR)/obj32/%.o, $(CXXSOURCES))
ALL_DEPS := $(sort $(CDEPS) $(CXXDEPS))
ALL_OBJECTS := $(sort $(COBJECTS) $(CXXOBJECTS))
CDEPS64 := $(patsubst %.c, $(BUILDDIR)/obj64/%.cdep, $(CSOURCES))
CXXDEPS64 := $(patsubst %.cpp, $(BUILDDIR)/obj64/%.cppdep, $(CXXSOURCES))
COBJECTS64 := $(patsubst %.c, $(BUILDDIR)/obj64/%.o, $(CSOURCES))
CXXOBJECTS64 := $(patsubst %.cpp, $(BUILDDIR)/obj64/%.o, $(CXXSOURCES))
ALL_DEPS64 := $(sort $(CDEPS64) $(CXXDEPS64))
ALL_OBJECTS64 := $(sort $(COBJECTS64) $(CXXOBJECTS64))
CFLAGS := $(DEFINES) $(INCLUDES) -fPIC -fvisibility=hidden -Wall
.PHONY: all clean $(TARGET)
.SECONDARY: $(ALL_OBJECTS) $(ALL_OBJECTS64) $(ALL_DEPS)
$(TARGET): $(BUILDDIR)/$(TARGET)/32/lin.xpl $(BUILDDIR)/$(TARGET)/64/lin.xpl
$(BUILDDIR)/$(TARGET)/64/lin.xpl: $(ALL_OBJECTS64)
@echo Linking $@
mkdir -p $(dir $@)
gcc -m64 -static-libgcc -shared -Wl,--version-script=exports.txt -o $@ $(ALL_OBJECTS64) $(LIBS)
$(BUILDDIR)/$(TARGET)/32/lin.xpl: $(ALL_OBJECTS)
@echo Linking $@
mkdir -p $(dir $@)
gcc -m32 -static-libgcc -shared -Wl,--version-script=exports.txt -o $@ $(ALL_OBJECTS) $(LIBS)
$(BUILDDIR)/obj32/%.o : %.c
mkdir -p $(dir $@)
g++ $(CFLAGS) -m32 -c $< -o $@
g++ $(CFLAGS) -MM -MT $@ -o $(@:.o=.cdep) $<
$(BUILDDIR)/obj32/%.o : %.cpp
mkdir -p $(dir $@)
g++ $(CFLAGS) -m32 -c $< -o $@
g++ $(CFLAGS) -MM -MT $@ -o $(@:.o=.cppdep) $<
$(BUILDDIR)/obj64/%.o : %.c
mkdir -p $(dir $@)
g++ $(CFLAGS) -m64 -c $< -o $@
g++ $(CFLAGS) -MM -MT $@ -o $(@:.o=.cdep) $<
$(BUILDDIR)/obj64/%.o : %.cpp
mkdir -p $(dir $@)
g++ $(CFLAGS) -m64 -c $< -o $@
g++ $(CFLAGS) -MM -MT $@ -o $(@:.o=.cppdep) $<
clean:
@echo Cleaning out everything.
rm -rf $(BUILDDIR)
install:
cp -r $(BUILDDIR)/$(TARGET)/32 /data/bo/X-Plane\ 10/Resources/plugins/$(TARGET)/
cp -r $(BUILDDIR)/$(TARGET)/64 /data/bo/X-Plane\ 10/Resources/plugins/$(TARGET)/
# Include any dependency turds, but don't error out if they don't exist.
# On the first build, every .c is dirty anyway. On future builds, if the
# .c changes, it is rebuilt (as is its dep) so who cares if dependencies
# are stale. If the .c is the same but a header has changed, this
# declares the header to be changed. If a primary header includes a
# utility header and the primary header is changed, the dependency
# needs a rebuild because EVERY header is included. And if the secondary
# header is changed, the primary header had it before (and is unchanged)
# so that is in the dependency file too.
-include $(ALL_DEPS)
-include $(ALL_DEPS64)