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