-
Notifications
You must be signed in to change notification settings - Fork 129
/
Copy pathMakefile.master
111 lines (97 loc) · 3.41 KB
/
Makefile.master
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
107
108
109
110
111
# Makefile for OpenFX Examples
# Copyright OpenFX and contributors to the OpenFX project.
# SPDX-License-Identifier: BSD-3-Clause
ifeq ($(CONFIG), debug)
DEBUGFLAG = -g -DDEBUG -Wall -Wextra
DEBUGNAME = debug
endif
ifeq ($(CONFIG), release)
DEBUGFLAG = -O3 -DNDEBUG
DEBUGNAME = release
endif
BITS := 32
ifeq ($(shell getconf LONG_BIT),64)
BITS := 64
endif
OS := $(shell uname -s)
DEBUGFLAG ?= -g
DEBUGNAME ?= debug
ifeq ($(DEBUGFLAG),-O3)
DEBUGNAME = release
endif
CXXSTANDARD ?= --std=c++11
OBJECTPATH = $(OS)-$(BITS)-$(DEBUGNAME)
$(OBJECTPATH)/%.o : %.cpp
mkdir -p $(OBJECTPATH)
$(CXX) -c $(CXXFLAGS) $(CXXSTANDARD) $(CXXARCH) $< -o $@
all: $(OBJECTPATH)/$(PLUGINNAME).ofx.bundle
CXXSTDFLAG ?= --std=gnu++14
ifeq ($(OS),$(filter $(OS),MINGW64_NT-6.1 MINGW32_NT-6.1))
LINKFLAGS = -shared -fvisibility=hidden -lopengl32
ARCH = Win32
BITSFLAG = -m32
ifeq ($(BITS), 64)
BITSFLAG = -m64
ARCH = Win64
endif
LINKFLAGS := $(LINKFLAGS) $(BITSFLAG)
endif
ifeq ($(OS),Linux)
# use $ORIGIN to link to bundled libraries first, see http://itee.uq.edu.au/~daniel/using_origin/
LINKFLAGS = -shared -fvisibility=hidden -lGL -Wl,-rpath,'$$ORIGIN'/../../Libraries
ARCH = Linux-x86
BITSFLAG = -m32 -fPIC
ifeq ($(BITS), 64)
BITSFLAG = -m64 -fPIC
ARCH = Linux-x86-64
endif
LINKFLAGS := $(LINKFLAGS) $(BITSFLAG)
endif
ifeq ($(OS),FreeBSD)
LINKFLAGS = -L/usr/local/lib -shared -fvisibility=hidden -lGL -Wl,-rpath,'$$ORIGIN'/../../Libraries
ARCH= FreeBSD-x86
BITSFLAG = -m32 -fPIC
ifeq ($(BITS), 64)
BITSFLAG = -m64 -fPIC
ARCH = FreeBSD-x86-64
endif
LINKFLAGS := $(LINKFLAGS) $(BITSFLAG)
endif
ifeq ($(OS),Darwin)
ifeq ($(BITS), Universal)
# Universal 32/64 is useful only on OSX 10.4 (i386/ppc), 10.5 (i386/ppc) and 10.6 (i386/x86_64).
# OSX 10.6 (Snow Leopard) or later, build for i386/x86_64
MACOSX := 10.6
MACOSXSDK := 10.6
ARCHFLAGS=-arch i386 -arch x86_64
ifeq ($(shell uname -r | sed 's/^\(.*\)\..*\..*/\1/'), 8)
# OSX 10.4 (Tiger)
MACOSX := 10.4
MACOSXSDK := 10.4u
ARCHFLAGS=-arch i386 -arch ppc
endif
ifeq ($(shell uname -r | sed 's/^\(.*\)\..*\..*/\1/'), 9)
# OSX 10.5 (Leopard)
MACOSX := 10.5
MACOSXSDK := 10.5
ARCHFLAGS=-arch i386 -arch ppc
endif
BITSFLAG = -isysroot /Developer/SDKs/MacOSX$(MACOSXSDK).sdk $(ARCHFLAGS) -mmacosx-version-min=$(MACOSX) -fPIC
endif
LINKFLAGS = $(BITSFLAG) -bundle -fvisibility=hidden -framework OpenGL -Wl,-rpath,@loader_path/../Frameworks -Wl,-rpath,@loader_path/../Libraries
ARCH = MacOS
endif
CXXFLAGS := $(DEBUGFLAG) -I$(PATHTOROOT)/../include -I$(PATHTOROOT)/include $(BITSFLAG) $(CXXSTDFLAG) -fvisibility=hidden $(CXXFLAGS_ADD)
$(OBJECTPATH)/$(PLUGINNAME).ofx: $(addprefix $(OBJECTPATH)/,$(PLUGINOBJECTS))
mkdir -p $(OBJECTPATH)/
$(CXX) $^ $(LINKFLAGS) $(LDFLAGS_ADD) -o $@
$(OBJECTPATH)/$(PLUGINNAME).ofx.bundle: $(OBJECTPATH)/$(PLUGINNAME).ofx
mkdir -p $@/Contents/$(ARCH)
cp $^ $@/Contents/$(ARCH)
cp Info.plist $@/Contents/
if [ -n "$(RESOURCES)" ]; then mkdir -p $@/Contents/Resources; cp $(RESOURCES) $@/Contents/Resources; fi
if [ $(DEBUGNAME) = "release" -a $(ARCH) = "MacOS" ]; then bash $(PATHTOROOT)/include/osxDeploy.sh $@ $(PLUGINNAME).ofx; fi
clean:
rm -rf $(OBJECTPATH)/ $(PATHTOROOT)/Library/$(OBJECTPATH)/
release:
make DEBUGFLAG=-O3