-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile.mac64
More file actions
72 lines (51 loc) · 1.94 KB
/
Makefile.mac64
File metadata and controls
72 lines (51 loc) · 1.94 KB
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
include Makefile.common
OBJDIR=./build/mac
TARGET=build/mac.xpl
TARGET_arm=$(OBJDIR)/mac.xpl_arm
TARGET_x86=$(OBJDIR)/mac.xpl_x86
OBJECTS_=$(SOURCES_C:.c=.o) $(SOURCES_CPP:.cpp=.o)
OBJECTS_arm=$(addprefix $(OBJDIR)/, $(OBJECTS_:.o=.o_arm))
OBJECTS_x86=$(OBJECTS_arm:.o_arm=.o_x86)
# if we run this script on Linux it's osxcross
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
CCx=clang -target x86_64-apple-macos13
CCa=clang -target arm64-apple-macos13
CXXx=clang++ -target x86_64-apple-macos13
CXXa=clang++ -target arm64-apple-macos13
else
PATH:=/osxcross/target/bin:$(PATH)
CCx=o64-clang -mmacosx-version-min=13.0
CCa=oa64-clang -mmacosx-version-min=13.0
CXXx=o64-clang++ -mmacosx-version-min=13.0
CXXa=oa64-clang++ -mmacosx-version-min=13.0
# the latest SDK has a framework format that is currently not understood by osxcross
SDK=../SDK-4.0.1
endif
DEFS=
CFLAGS+=$(OPT) -Wall -DAPL=1 $(INCLUDES) $(DEFINES) \
-fPIC -fno-stack-protector -fvisibility=hidden
CXXFLAGS:=$(CXXSTD) $(CFLAGS)
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
#test:
# $(foreach var,$(.VARIABLES),$(info $(var) = $($(var))))
all: $(TARGET)
$(shell [ -d $(OBJDIR) ] || mkdir -p $(OBJDIR))
$(OBJDIR)/%.o_arm: %.c
$(CCa) $(CFLAGS) -o $@ -c $<
$(OBJDIR)/%.o_x86: %.c
$(CCx) $(CFLAGS) -o $@ -c $<
$(OBJDIR)/%.o_arm: %.cpp
$(CXXa) $(CXXFLAGS) -o $@ -c $<
$(OBJDIR)/%.o_x86: %.cpp
$(CXXx) $(CXXFLAGS) -o $@ -c $<
$(TARGET_arm): $(OBJECTS_arm)
$(CXXa) -o $@ $(ARCH_arm) $(LNFLAGS) $(OBJECTS_arm) $(LIBS)
$(TARGET_x86): $(OBJECTS_x86)
$(CXXx) -o $@ $(ARCH_x86) $(LNFLAGS) $(OBJECTS_x86) $(LIBS)
$(TARGET): $(TARGET_arm) $(TARGET_x86)
lipo -create -output $@ $(TARGET_arm) $(TARGET_x86)
clean:
rm -f $(TARGET) $(OBJDIR)/*.o_* $(OBJDIR)/*.xpl_*