-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.master
196 lines (175 loc) · 6.93 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# Software License :
#
# Copyright (c) 2003-2015, The Open Effects Association Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name The Open Effects Association Ltd, nor the names of its
# contributors may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
OPTFLAG = -O2
ifeq ($(CONFIG), debug)
DEBUGFLAG = -g -DDEBUG -Wall -Wextra
DEBUGNAME = debug
endif
ifeq ($(CONFIG), release)
DEBUGFLAG = $(OPTFLAG) -DNDEBUG
DEBUGNAME = release
endif
ifeq ($(CONFIG), relwithdebinfo)
DEBUGFLAG = $(OPTFLAG) -g -DNDEBUG
DEBUGNAME = relwithdebinfo
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
ifeq ($(OS:MINGW%=MINGW),MINGW)
PLUGINPATH=C:\\Program Files\\Common Files\\OFX\\Plugins
endif
ifeq ($(OS),Linux)
PLUGINPATH=/usr/OFX/Plugins
endif
ifeq ($(OS),FreeBSD)
PLUGINPATH=/usr/OFX/Plugins
endif
ifeq ($(OS),Darwin)
PLUGINPATH=/Library/OFX/Plugins
endif
OBJECTPATH = $(OUT_DIR)/$(OS)-$(BITS)-$(DEBUGNAME)
# the following is inspired by automake's verbosity mechanism. compile with "make V=1" to get verbose output
V=0
AM_V_CXX = $(am__v_CXX_$(V))
am__v_CXX_0 = @echo " CXX " $@;
am__v_CXX_1 =
AM_V_NVCC = $(am__v_NVCC_$(V))
am__v_NVCC_0 = @echo " NVCC " $@;
am__v_NVCC_1 =
AM_V_CXXLD = $(am__v_CXXLD_$(V))
am__v_CXXLD_0 = @echo " CXXLD " $@;
am__v_CXXLD_1 =
$(OBJECTPATH)/src/%.o : $(SRC_DIR)/%.cpp
@mkdir -p $(OUT_DIR)
@mkdir -p $(OBJECTPATH)
$(AM_V_CXX)$(CXX) -c $(CXXFLAGS) $(SRC_DIR)/$(notdir $<) -o $(OBJECTPATH)/$(notdir $@)
$(OBJECTPATH)/%.o : %.cpp
@mkdir -p $(OUT_DIR)
@mkdir -p $(OBJECTPATH)
$(AM_V_CXX)$(CXX) -c $(CXXFLAGS) $< -o $@
$(OBJECTPATH)/%.o : %.cu
@mkdir -p $(OUT_DIR)
@mkdir -p $(OBJECTPATH)
$(AM_V_NVCC)$(NVCC) -c $(CUFLAGS) $< -o $@
SUPPORTOBJECTS ?= \
ofxsMultiThread.o \
ofxsInteract.o \
ofxsProperty.o \
ofxsLog.o \
ofxsCore.o \
ofxsPropertyValidation.o \
ofxsImageEffect.o \
ofxsParams.o
VPATH += $(PATHTOROOT)/Library
.PHONY: all install uninstall
all: $(OBJECTPATH)/$(PLUGINNAME).ofx.bundle
install:
@mkdir -p $(DESTDIR)$(PLUGINPATH)
(cd $(OBJECTPATH); tar cf - $(PLUGINNAME).ofx.bundle) | (cd "$(DESTDIR)$(PLUGINPATH)"; tar xvf -)
uninstall:
rm -rf "$(PLUGINPATH)/$(PLUGINNAME).ofx.bundle"
ifeq ($(OS:MINGW%=MINGW),MINGW)
LINKFLAGS = -shared -fvisibility=hidden -Xlinker --version-script=$(PATHTOROOT)/include/linuxSymbols -lopengl32
ARCH = Win32
BITSFLAG = -m32
ifeq ($(BITS), 64)
BITSFLAG = -m64
ARCH = Win64
endif
# mingw64 runtime >=3 or mingw32 runtime>=3.15 is required to get a proper snprintf implementation,
# which is triggered by the following CPPFLAGS.
CPPFLAGS = -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
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 -Xlinker --version-script=$(PATHTOROOT)/include/linuxSymbols -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 -Xlinker --version-script=$(PATHTOROOT)/include/linuxSymbols -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$(MACOSX).sdk $(ARCHFLAGS) -mmacosx-version-min=$(MACOSX) -fPIC
endif
LINKFLAGS = $(BITSFLAG) -bundle -fvisibility=hidden -exported_symbols_list $(PATHTOROOT)/include/osxSymbols -framework OpenGL -Wl,-rpath,@loader_path/../Frameworks -Wl,-rpath,@loader_path/../Libraries
ARCH = MacOS
endif
CXXFLAGS := $(DEBUGFLAG) $(CPPFLAGS) -I$(PATHTOROOT)/../include -I$(PATHTOROOT)/include -I$(PATHTOROOT)/Plugins/include $(BITSFLAG) -fvisibility=hidden $(CXXFLAGS_ADD) $(CXXFLAGS_EXTRA)
$(OBJECTPATH)/$(PLUGINNAME).ofx: $(addprefix $(OBJECTPATH)/,$(PLUGINOBJECTS) $(SUPPORTOBJECTS))
@mkdir -p $(OUT_DIR)
@mkdir -p $(OBJECTPATH)/
$(AM_V_CXXLD)$(CXX) $(addprefix $(OBJECTPATH)/,$(patsubst $(SRC_DIR)/%.o,%.o,$(PLUGINOBJECTS)) $(SUPPORTOBJECTS)) $(LINKFLAGS) $(LDFLAGS_ADD) $(LDFLAGS_EXTRA) -o $@
$(OBJECTPATH)/$(PLUGINNAME).ofx.bundle: $(OBJECTPATH)/$(PLUGINNAME).ofx
mkdir -p $@/Contents/$(ARCH)
cp $^ $@/Contents/$(ARCH)
cp Info.plist $@/Contents/ 2>/dev/null || :
if [ -n "$(RESOURCES)" ]; then mkdir -p $@/Contents/Resources; cp -r $(RESOURCES) $@/Contents/Resources; fi
if [ \( $(DEBUGNAME) = "release" -o $(DEBUGNAME) = "relwithdebinfo" \) -a $(ARCH) = "MacOS" ]; then bash $(PATHTOROOT)/include/osxDeploy.sh $@ $(PLUGINNAME).ofx; fi
clean :
rm -rf $(OUT_DIR)
release :
make DEBUGFLAG=-O3