-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile.osxcross
74 lines (52 loc) · 2.48 KB
/
Makefile.osxcross
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_XP12=openSAM-pkg/openSAM
PLUGDIR_XP11=openSAM-pkg_XP11/openSAM
include version.mak
#https://stackoverflow.com/questions/61311317/change-path-in-makefile
export PATH:=/osxcross/target/bin:$(PATH)
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=o64-clang++ -mmacosx-version-min=12.0
CCa=oa64-clang++ -mmacosx-version-min=12.0
DEFS= -DAPL=1 -fPIC -fno-stack-protector -fvisibility=hidden -ffast-math -DNDEBUG
CFLAGS+=-O2 -Wall -Wno-deprecated-declarations \
-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 \
/osxcross/target/macports/pkgs/opt/local/lib/libexpat.a
# ships with macOS
LIBS+=
#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 $(OBJDIR)/*.o_* $(OBJDIR)/*.xpl_*