-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile.mac64
74 lines (50 loc) · 2.4 KB
/
Makefile.mac64
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
PLUGDIR=openSAM-pkg/openSAM
include version.mak
PLUGDIR_XP12=openSAM-pkg/openSAM
PLUGDIR_XP11=openSAM-pkg_XP11/openSAM
include version.mak
SDK=../SDK
OBJDIR=./OBJ_osx
TARGET_XP12=$(OBJDIR)/openSAM.xpl
TARGET_XP11=$(OBJDIR)/openSAM.xpl_xp11
HEADERS=$(wildcard *.h)
SOURCES=openSAM.cpp os_dgs.cpp os_jw.cpp os_ui.cpp os_anim.cpp sam_xml.cpp log_msg.cpp read_wav.cpp
OBJECTS_XP12_arm=$(addprefix $(OBJDIR)/, $(SOURCES:.cpp=.o_arm)) $(OBJDIR)/os_sound.o_arm
OBJECTS_XP12_x86=$(OBJECTS_XP12_arm:.o_arm=.o_x86)
OBJECTS_XP11_arm=$(addprefix $(OBJDIR)/, $(SOURCES:.cpp=.o_arm)) $(OBJDIR)/os_sound_xp11.o_arm
OBJECTS_XP11_x86=$(OBJECTS_XP11_arm:.o_arm=.o_x86)
CCx=clang++ -target x86_64-apple-macos11
CCa=clang++ -target arm64-apple-macos11
DEFS= -DAPL=1 -fPIC -fno-stack-protector -fvisibility=hidden -ffast-math -DNDEBUG -Wno-deprecated-declarations
CFLAGS+=-std=c++17 -O2 -Wall -I$(SDK)/CHeaders/XPLM -I$(SDK)/CHeaders/Widgets -DVERSION=\"$(VERSION)\" $(DEFS)
LNFLAGS+=-dynamiclib -shared -rdynamic -fvisibility=hidden -Wl,-exported_symbols_list -Wl,linkscript.mac
# https://pewpewthespells.com/blog/static_and_dynamic_libraries.html
LIBS+= -F $(SDK)/Libraries/Mac -framework XPLM -framework XPWidgets
# ships with macOS or macPorts
LIBS+=/opt/local/lib/libexpat.a
#test:
# $(foreach var,$(.VARIABLES),$(info $(var) = $($(var))))
all: $(TARGET_XP12) $(TARGET_XP11)
$(shell [ -d $(OBJDIR) ] || mkdir $(OBJDIR))
$(OBJDIR)/%.o_arm: %.cpp version.mak
$(CCa) $(CFLAGS) -o $@ -c $<
$(OBJDIR)/%.o_x86: %.cpp version.mak
$(CCx) $(CFLAGS) -o $@ -c $<
$(TARGET_XP12)_arm: $(OBJECTS_XP12_arm)
$(CCa) -o $@ $(LNFLAGS) $(OBJECTS_XP12_arm) $(LIBS)
$(TARGET_XP12)_x86: $(OBJECTS_XP12_x86)
$(CCx) -o $@ $(LNFLAGS) $(OBJECTS_XP12_x86) $(LIBS)
$(TARGET_XP12): $(TARGET_XP12)_arm $(TARGET_XP12)_x86
lipo -create -output $@ $(TARGET_XP12)_arm $(TARGET_XP12)_x86
mkdir -p "$(PLUGDIR_XP12)/mac_x64"
cp -p $(TARGET_XP12) "$(PLUGDIR_XP12)/mac_x64/openSAM.xpl"
$(TARGET_XP11)_arm: $(OBJECTS_XP11_arm)
$(CCa) -o $@ $(LNFLAGS) $(OBJECTS_XP11_arm) $(LIBS) -framework OpenAL
$(TARGET_XP11)_x86: $(OBJECTS_XP11_x86)
$(CCx) -o $@ $(LNFLAGS) $(OBJECTS_XP11_x86) $(LIBS) -framework OpenAL
$(TARGET_XP11): $(TARGET_XP11)_arm $(TARGET_XP11)_x86
lipo -create -output $@ $(TARGET_XP11)_arm $(TARGET_XP11)_x86
mkdir -p "$(PLUGDIR_XP11)/mac_x64"
cp -p $(TARGET_XP11) "$(PLUGDIR_XP11)/mac_x64/openSAM.xpl"
clean:
rm -f $(TARGET) $(OBJDIR)/*.o_* $(OBJDIR)/*.xpl_*