Subversion Repositories filter_foundry

Rev

Rev 292 | Rev 484 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
18 toby 1
# This file is part of "Filter Foundry", a filter plugin for Adobe Photoshop
192 daniel-mar 2
# Copyright (C) 2003-2009 Toby Thain, toby@telegraphics.com.au
3
# Copyright (C) 2018-2019 Daniel Marschall, ViaThinkSoft
2 toby 4
 
5
# This program is free software; you can redistribute it and/or modify
6
# it under the terms of the GNU General Public License as published by  
7
# the Free Software Foundation; either version 2 of the License, or
8
# (at your option) any later version.
9
 
10
# This program is distributed in the hope that it will be useful,
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
# GNU General Public License for more details.
14
 
15
# You should have received a copy of the GNU General Public License  
16
# along with this program; if not, write to the Free Software
17
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
 
8 toby 19
# GNU Makefile
20
# builds Win32 DLL and CS2/Mac Mach-O plugin bundle
2 toby 21
 
22
 
8 toby 23
# ---------- variables & flags ----------
24
 
25
EXEC = FilterFoundry
26
 
67 toby 27
VERSION = $(shell perl -n -e 'm/^.*VERSION_STR[[:blank:]]+\"([^"]*)\"/ && print $$1;' version.h)
28
 
8 toby 29
MINGW_CC = i386-mingw32msvc-gcc
30
DLLWRAP  = i386-mingw32msvc-dllwrap
31
WINDRES  = i386-mingw32msvc-windres
32
 
52 toby 33
# use GNU flex and bison
34
# these lines can be commented to use system lex and yacc
35
# although this may result in a larger overall executable
2 toby 36
LEX = flex
37
YACC = bison -y
38
YFLAGS = -d
39
 
192 daniel-mar 40
PSAPI = "photoshop_sdk/pluginsdk/photoshopapi"
8 toby 41
 
23 toby 42
CFLAGS += -O2 -W -Wall -Wno-main -Wno-unused-parameter -Wno-multichar
102 toby 43
CPPFLAGS += -DYY_SKIP_YYWRAP \
44
            -I$(PSAPI)/pica_sp -I$(PSAPI)/photoshop -I$(PSAPI)/general \
193 daniel-mar 45
            -Itelegraphics_common/adobeplugin -Itelegraphics_common/tt
2 toby 46
 
47
 
8 toby 48
# ---------- source & object files ----------
2 toby 49
 
8 toby 50
# where to find .c source files
193 daniel-mar 51
vpath %.c telegraphics_common/tt telegraphics_common/adobeplugin ../MoreFiles/Sources
2 toby 52
 
8 toby 53
# list of source files
135 dmarschall 54
SRC_COMMON = main.c funcs.c process.c node.c symtab.c \
292 daniel-mar 55
	ui.c ui_build.c preview.c read.c save.c make.c obfusc.c \
96 toby 56
	scripting.c y.tab.c lex.yy.c str.c
57
SRC_OSX = dbg_mac.c ui_mac.c make_mac.c load_mac.c ui_compat_mac.c \
58
	choosefile_nav.c preview_mac.c \
8 toby 59
	MoreFilesExtras.c MoreFiles.c MoreDesktopMgr.c FileCopy.c Search.c
159 dmarschall 60
SRC_W32 = dbg_win.c manifest.c ui_win.c make_win.c versioninfo_modify_win.c load_win.c ui_compat_win.c \
96 toby 61
	choosefile_win.c ui_build_win.c compat_string.c compat_win.c \
439 daniel-mar 62
	file_compat_win.c dllmain.c slider_win.c
2 toby 63
 
8 toby 64
# derive lists of object files, separate for each platform
65
OBJ_OSX := $(patsubst %.c, obj/%.o,     $(SRC_COMMON) $(SRC_OSX))
66 toby 66
OBJ_W32 := $(patsubst %.c, obj_w32/%.o, $(SRC_COMMON) $(SRC_W32)) obj_w32/res.o
2 toby 67
 
8 toby 68
 
69
# ---------- executables ----------
70
 
71
# parts of Mac OS X plugin bundle to build
72
# Adobe's plugs use .plugin extension
99 toby 73
BUNDLE = $(EXEC).plugin
8 toby 74
PLUGIN_OSX  = $(BUNDLE)/Contents/MacOS/$(EXEC)
75
PLUGIN_RSRC = $(BUNDLE)/Contents/Resources/$(EXEC).rsrc
67 toby 76
PLUGIN_PARTS = $(PLUGIN_OSX) $(PLUGIN_RSRC) $(BUNDLE)/Contents/Info.plist $(BUNDLE)/Contents/PkgInfo
196 daniel-mar 77
DISTDMG = $(EXEC)-$(VERSION).dmg
8 toby 78
 
99 toby 79
$(PLUGIN_OSX) : CPPFLAGS += -DMAC_ENV -DMACMACHO -Dmacintosh \
8 toby 80
	-I/Developer/Headers/FlatCarbon \
81
	-I../MoreFiles/CHeaders -I../MoreFiles/Sources
82
 
83
# Win32 plugin DLL to build
23 toby 84
PLUGIN_W32 = $(EXEC).8bf
196 daniel-mar 85
DISTZIP = $(EXEC)-$(VERSION)-win.zip
8 toby 86
 
87
$(PLUGIN_W32) : CPPFLAGS += -DWIN_ENV
88
 
89
 
90
# ---------- targets ----------
91
 
92
# build everything
93
all : dll osx
94
 
95
dll : $(PLUGIN_W32)
96
 
96 toby 97
osx fat : $(BUNDLE) $(PLUGIN_PARTS)
8 toby 98
 
237 daniel-mar 99
# See: https://web.archive.org/web/20101224050959/http://developer.apple.com/library/mac/#documentation/Porting/Conceptual/PortingUnix/intro/intro.html
64 toby 100
fat : CFLAGS += -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386
101
fat : LDFLAGS += -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386
102
fat : REZFLAGS += -arch ppc -arch i386
103
 
8 toby 104
$(BUNDLE) :
105
	mkdir -p $@
66 toby 106
	/Developer/Tools/SetFile -a B $@
8 toby 107
 
108
# insert correct executable name and version string in bundle's Info.plist
65 toby 109
$(BUNDLE)/Contents/Info.plist : Info.plist $(BUNDLE) version.h
64 toby 110
	mkdir -p $(dir $@)
8 toby 111
	V=`sed -n -E 's/^.*VERSION_STR[[:blank:]]+\"([^"]*)\"/\1/p' version.h` ;\
52 toby 112
		sed -e s/VERSION_STR/$$V/ -e s/EXEC/$(EXEC)/ $< > $@
8 toby 113
 
66 toby 114
$(BUNDLE)/Contents/PkgInfo : $(BUNDLE)
115
	mkdir -p $(dir $@)
99 toby 116
	echo -n 8BFM8BIM > $@
66 toby 117
 
2 toby 118
clean :
66 toby 119
	rm -fr *.[ox] $(OBJ_OSX) $(OBJ_W32) $(PLUGIN_W32) $(BUNDLE) \
135 dmarschall 120
	       lex.yy.[ch] y.tab.[ch] temp
2 toby 121
 
8 toby 122
 
67 toby 123
dmg : $(DISTDMG)
2 toby 124
 
67 toby 125
# create an Apple disk image (dmg) archive of the distribution kit
196 daniel-mar 126
$(DISTDMG) : $(PLUGIN_PARTS) README.md LICENSE_GPLv3.html LICENSE_GPLv2.txt
67 toby 127
	@ DIR=`mktemp -d $(EXEC)-XXXX`; \
196 daniel-mar 128
	cp -Rp README.md LICENSE_GPLv3.html LICENSE_GPLv2.txt $(BUNDLE) $$DIR; \
67 toby 129
	mkdir -p $$DIR/examples; \
196 daniel-mar 130
	cp examples/*.afs $$DIR/examples; \
67 toby 131
	/Developer/Tools/SetFile -t TEXT -c ttxt $$DIR/examples/*; \
132
	hdiutil create -srcfolder $$DIR -ov -volname "$(EXEC) $(VERSION)" $@; \
133
	rm -fr $$DIR
134
	@ ls -l $@
135
 
136
 
137
zip : $(DISTZIP)
138
 
196 daniel-mar 139
$(DISTZIP) : $(PLUGIN_W32) README.md LICENSE_GPLv3.html LICENSE_GPLv2.txt examples/*.afs
104 toby 140
	T=`mktemp -d`; \
141
		D=$$T/FilterFoundry-$(VERSION); \
142
		mkdir -p $$D/examples; \
143
		cp $^ $$D; \
144
		mv $$D/*.afs $$D/examples; \
145
		cd $$T; \
146
		zip -9 -r temp.zip FilterFoundry-$(VERSION); \
147
		mv temp.zip $(PWD)/$@; \
148
		rm -fr $$T
2 toby 149
	ls -l $@
150
 
151
 
8 toby 152
# ---------- compile rules ----------
153
 
154
obj/%.o : %.c
9 toby 155
	$(CC) -o $@ -c $< $(CFLAGS) $(CPPFLAGS) -fpascal-strings
8 toby 156
obj_w32/%.o : %.c
157
	$(MINGW_CC) -o $@ -c $< $(CFLAGS) $(CPPFLAGS)
158
 
159
# note dependencies on version.h:
160
 
154 dmarschall 161
obj_w32/res.o : win_res.rc PiPL.rc PiPL_body.rc manifest.rc version_win.rc ui_win.rc caution.ico ui.h version.h
8 toby 162
	$(WINDRES) -o $@ -i $< --language=0 $(CPPFLAGS)
163
 
70 toby 164
lex.yy.c : lexer.l y.tab.h
214 daniel-mar 165
	$(LEX) --never-interactive $<
70 toby 166
y.tab.c y.tab.h : parser.y
8 toby 167
	$(YACC) $< $(YFLAGS)
168
 
70 toby 169
obj_w32/funcs.o : ff.h funcs.h symtab.h ui.h PARM.h y.tab.h
170
obj_w32/lex.yy.o : node.h symtab.h y.tab.h
8 toby 171
obj_w32/load_win.o : ff.h funcs.h symtab.h ui.h PARM.h
70 toby 172
obj_w32/main.o : ff.h funcs.h symtab.h ui.h PARM.h node.h scripting.h y.tab.h 
8 toby 173
obj_w32/make.o : ff.h funcs.h symtab.h ui.h PARM.h
292 daniel-mar 174
obj_w32/obfusc.o : ff.h funcs.h symtab.h ui.h PARM.h
439 daniel-mar 175
obj_w32/slider.c : ff.h
8 toby 176
obj_w32/make_win.o : ff.h funcs.h symtab.h ui.h PARM.h
113 dmarschall 177
obj_w32/versioninfo_modify_win.o : ff.h funcs.h symtab.h ui.h PARM.h
70 toby 178
obj_w32/node.o : node.h y.tab.h funcs.h symtab.h ui.h PARM.h
179
obj_w32/y.tab.o : node.h y.tab.h
180
obj_w32/preview.o : ff.h funcs.h symtab.h ui.h PARM.h node.h y.tab.h
181
obj_w32/process.o : ff.h funcs.h symtab.h ui.h PARM.h node.h y.tab.h
8 toby 182
obj_w32/read.o : ff.h funcs.h symtab.h ui.h PARM.h
183
obj_w32/save.o : ff.h funcs.h symtab.h ui.h PARM.h
184
obj_w32/scripting.o : ff.h funcs.h symtab.h ui.h PARM.h scripting.h
185
obj_w32/symtab.o : symtab.h
70 toby 186
obj_w32/ui.o : ff.h funcs.h symtab.h ui.h PARM.h node.h y.tab.h
8 toby 187
obj_w32/ui_build.o : ff.h funcs.h symtab.h ui.h PARM.h
188
obj_w32/ui_build_win.o : ff.h funcs.h symtab.h ui.h PARM.h version.h
189
obj_w32/ui_win.o : ff.h funcs.h symtab.h ui.h PARM.h version.h
159 dmarschall 190
obj_w32/manifest.o : manifest.h
8 toby 191
 
70 toby 192
obj/funcs.o : ff.h funcs.h symtab.h ui.h PARM.h y.tab.h
193
obj/lex.yy.o : node.h symtab.h y.tab.h
8 toby 194
obj/load_mac.o : ff.h funcs.h symtab.h ui.h PARM.h
70 toby 195
obj/main.o : ff.h funcs.h symtab.h ui.h PARM.h node.h scripting.h y.tab.h 
8 toby 196
obj/make.o : ff.h funcs.h symtab.h ui.h PARM.h
292 daniel-mar 197
obj/obfusc.o : ff.h funcs.h symtab.h ui.h PARM.h
8 toby 198
obj/make_mac.o : ff.h funcs.h symtab.h ui.h PARM.h
70 toby 199
obj/node.o : node.h y.tab.h funcs.h symtab.h ui.h PARM.h
200
obj/y.tab.o : node.h symtab.h y.tab.h
201
obj/preview.o : ff.h funcs.h symtab.h ui.h PARM.h node.h y.tab.h
202
obj/process.o : ff.h funcs.h symtab.h ui.h PARM.h node.h y.tab.h
8 toby 203
obj/read.o : ff.h funcs.h symtab.h ui.h PARM.h
204
obj/save.o : ff.h funcs.h symtab.h ui.h PARM.h
205
obj/scripting.o : ff.h funcs.h symtab.h ui.h PARM.h scripting.h
206
obj/symtab.o : symtab.h
70 toby 207
obj/ui.o : ff.h funcs.h symtab.h ui.h PARM.h node.h y.tab.h
8 toby 208
obj/ui_build.o : ff.h funcs.h symtab.h ui.h PARM.h
209
obj/ui_mac.o : ff.h funcs.h symtab.h ui.h PARM.h
210
 
211
# compile Mac resources (into data fork of .rsrc file)
64 toby 212
$(PLUGIN_RSRC) : $(BUNDLE) PiPL_macho.r ui_mac.r scripting.r ui.h version.h
8 toby 213
	mkdir -p $(dir $@)
64 toby 214
	/Developer/Tools/Rez -o $@ -useDF $(REZFLAGS) $(filter %.r,$^) \
8 toby 215
		-i /Developer/Headers/FlatCarbon \
216
		-i $(PSAPI)/Resources \
217
		-i $(PSAPI)/Photoshop
2 toby 218
	ls -l $@
219
 
220
 
8 toby 221
# ---------- link rules ----------
2 toby 222
 
8 toby 223
# link OS X Mach-O executable
66 toby 224
$(PLUGIN_OSX) : $(BUNDLE) exports.exp $(OBJ_OSX)
8 toby 225
	mkdir -p $(dir $@)
64 toby 226
	$(CC) -bundle -o $@ $(OBJ_OSX) \
227
		$(LDFLAGS) -exported_symbols_list exports.exp \
8 toby 228
		-framework Carbon -framework System
229
	ls -l $@
64 toby 230
	file $@
2 toby 231
 
8 toby 232
# link Win32 DLL
66 toby 233
$(PLUGIN_W32) : exports.def $(OBJ_W32)
8 toby 234
	$(DLLWRAP) -o $@ -def $^ -mwindows -s
235
	ls -l $@
2 toby 236
 
237
 
8 toby 238
# --------------------