Rev 96 | 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 | |||
64 | 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 |
8 | toby | 44 | CPPFLAGS += -I$(PSAPI)/Pica_sp -I$(PSAPI)/Photoshop -I$(PSAPI)/General \ |
2 | toby | 45 | -I../common/adobeplugin -I../common/tt |
46 | |||
47 | |||
8 | toby | 48 | # ---------- source & object files ---------- |
2 | toby | 49 | |
8 | toby | 50 | # where to find .c source files |
51 | vpath %.c ../common/tt ../common/adobeplugin ../MoreFiles/Sources |
||
2 | toby | 52 | |
8 | toby | 53 | # list of source files |
96 | toby | 54 | SRC_COMMON = main.c funcs.c trigtab.c process.c node.c symtab.c \ |
55 | sprintf_tiny.c ui.c ui_build.c preview.c read.c save.c make.c \ |
||
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 |
96 | toby | 60 | SRC_W32 = dbg_win.c ui_win.c make_win.c load_win.c ui_compat_win.c \ |
61 | choosefile_win.c ui_build_win.c compat_string.c compat_win.c \ |
||
62 | file_compat_win.c dllmain.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 |
99 | toby | 77 | DISTDMG = dist/$(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 |
67 | toby | 85 | DISTZIP = dist/$(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 | |
64 | toby | 99 | # See: http://developer.apple.com/documentation/Porting/Conceptual/PortingUnix/compiling/chapter_4_section_3.html#//apple_ref/doc/uid/TP40002850-BAJCFEBA |
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) \ |
18 | toby | 120 | gentab trigtab.c 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 |
126 | $(DISTDMG) : $(PLUGIN_PARTS) dist/README.html dist/gpl.html |
||
127 | @ DIR=`mktemp -d $(EXEC)-XXXX`; \ |
||
128 | cp -Rp dist/README.html dist/gpl.html $(BUNDLE) $$DIR; \ |
||
129 | mkdir -p $$DIR/examples; \ |
||
130 | cp dist/examples/*.afs $$DIR/examples; \ |
||
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 | |||
139 | $(DISTZIP) : $(PLUGIN_W32) dist/README.html dist/gpl.html dist/examples/*.afs |
||
20 | toby | 140 | zip -j -9 -r $@ $^ |
2 | toby | 141 | ls -l $@ |
142 | |||
8 | toby | 143 | dist/gpl.html : |
144 | curl http://www.gnu.org/licenses/gpl.html | \ |
||
66 | toby | 145 | sed -e 's%</HEAD>%<BASE HREF="http://www.gnu.org/"> </HEAD>%' \ |
146 | -e 's%</head>%<BASE HREF="http://www.gnu.org/"> </HEAD>%' > $@ |
||
2 | toby | 147 | |
148 | |||
8 | toby | 149 | # ---------- compile rules ---------- |
150 | |||
151 | obj/%.o : %.c |
||
9 | toby | 152 | $(CC) -o $@ -c $< $(CFLAGS) $(CPPFLAGS) -fpascal-strings |
8 | toby | 153 | obj_w32/%.o : %.c |
154 | $(MINGW_CC) -o $@ -c $< $(CFLAGS) $(CPPFLAGS) |
||
155 | |||
156 | # note dependencies on version.h: |
||
157 | |||
158 | obj_w32/res.o : win_res.rc PiPL.rc PiPL_body.rc ui_win.rc caution.ico ui.h version.h |
||
159 | $(WINDRES) -o $@ -i $< --language=0 $(CPPFLAGS) |
||
160 | |||
70 | toby | 161 | lex.yy.c : lexer.l y.tab.h |
8 | toby | 162 | $(LEX) $< |
70 | toby | 163 | y.tab.c y.tab.h : parser.y |
8 | toby | 164 | $(YACC) $< $(YFLAGS) |
165 | |||
70 | toby | 166 | obj_w32/funcs.o : ff.h funcs.h symtab.h ui.h PARM.h y.tab.h |
167 | obj_w32/lex.yy.o : node.h symtab.h y.tab.h |
||
8 | toby | 168 | obj_w32/load_win.o : ff.h funcs.h symtab.h ui.h PARM.h |
70 | toby | 169 | obj_w32/main.o : ff.h funcs.h symtab.h ui.h PARM.h node.h scripting.h y.tab.h |
8 | toby | 170 | obj_w32/make.o : ff.h funcs.h symtab.h ui.h PARM.h |
171 | obj_w32/make_win.o : ff.h funcs.h symtab.h ui.h PARM.h |
||
70 | toby | 172 | obj_w32/node.o : node.h y.tab.h funcs.h symtab.h ui.h PARM.h |
173 | obj_w32/y.tab.o : node.h y.tab.h |
||
174 | obj_w32/preview.o : ff.h funcs.h symtab.h ui.h PARM.h node.h y.tab.h |
||
175 | obj_w32/process.o : ff.h funcs.h symtab.h ui.h PARM.h node.h y.tab.h |
||
8 | toby | 176 | obj_w32/read.o : ff.h funcs.h symtab.h ui.h PARM.h |
177 | obj_w32/save.o : ff.h funcs.h symtab.h ui.h PARM.h |
||
178 | obj_w32/scripting.o : ff.h funcs.h symtab.h ui.h PARM.h scripting.h |
||
179 | obj_w32/symtab.o : symtab.h |
||
70 | toby | 180 | obj_w32/ui.o : ff.h funcs.h symtab.h ui.h PARM.h node.h y.tab.h |
8 | toby | 181 | obj_w32/ui_build.o : ff.h funcs.h symtab.h ui.h PARM.h |
182 | obj_w32/ui_build_win.o : ff.h funcs.h symtab.h ui.h PARM.h version.h |
||
183 | obj_w32/ui_win.o : ff.h funcs.h symtab.h ui.h PARM.h version.h |
||
184 | |||
70 | toby | 185 | obj/funcs.o : ff.h funcs.h symtab.h ui.h PARM.h y.tab.h |
186 | obj/lex.yy.o : node.h symtab.h y.tab.h |
||
8 | toby | 187 | obj/load_mac.o : ff.h funcs.h symtab.h ui.h PARM.h |
70 | toby | 188 | obj/main.o : ff.h funcs.h symtab.h ui.h PARM.h node.h scripting.h y.tab.h |
8 | toby | 189 | obj/make.o : ff.h funcs.h symtab.h ui.h PARM.h |
190 | obj/make_mac.o : ff.h funcs.h symtab.h ui.h PARM.h |
||
70 | toby | 191 | obj/node.o : node.h y.tab.h funcs.h symtab.h ui.h PARM.h |
192 | obj/y.tab.o : node.h symtab.h y.tab.h |
||
193 | obj/preview.o : ff.h funcs.h symtab.h ui.h PARM.h node.h y.tab.h |
||
194 | obj/process.o : ff.h funcs.h symtab.h ui.h PARM.h node.h y.tab.h |
||
8 | toby | 195 | obj/read.o : ff.h funcs.h symtab.h ui.h PARM.h |
196 | obj/save.o : ff.h funcs.h symtab.h ui.h PARM.h |
||
197 | obj/scripting.o : ff.h funcs.h symtab.h ui.h PARM.h scripting.h |
||
198 | obj/symtab.o : symtab.h |
||
70 | toby | 199 | obj/ui.o : ff.h funcs.h symtab.h ui.h PARM.h node.h y.tab.h |
8 | toby | 200 | obj/ui_build.o : ff.h funcs.h symtab.h ui.h PARM.h |
201 | obj/ui_mac.o : ff.h funcs.h symtab.h ui.h PARM.h |
||
202 | |||
203 | gentab : gentab.c funcs.h ; $(CC) -o $@ $< -lm |
||
204 | trigtab.c : gentab ; ./gentab > $@ |
||
205 | |||
206 | # compile Mac resources (into data fork of .rsrc file) |
||
64 | toby | 207 | $(PLUGIN_RSRC) : $(BUNDLE) PiPL_macho.r ui_mac.r scripting.r ui.h version.h |
8 | toby | 208 | mkdir -p $(dir $@) |
64 | toby | 209 | /Developer/Tools/Rez -o $@ -useDF $(REZFLAGS) $(filter %.r,$^) \ |
8 | toby | 210 | -i /Developer/Headers/FlatCarbon \ |
211 | -i $(PSAPI)/Resources \ |
||
212 | -i $(PSAPI)/Photoshop |
||
2 | toby | 213 | ls -l $@ |
214 | |||
215 | |||
8 | toby | 216 | # ---------- link rules ---------- |
2 | toby | 217 | |
8 | toby | 218 | # link OS X Mach-O executable |
66 | toby | 219 | $(PLUGIN_OSX) : $(BUNDLE) exports.exp $(OBJ_OSX) |
8 | toby | 220 | mkdir -p $(dir $@) |
64 | toby | 221 | $(CC) -bundle -o $@ $(OBJ_OSX) \ |
222 | $(LDFLAGS) -exported_symbols_list exports.exp \ |
||
8 | toby | 223 | -framework Carbon -framework System |
224 | ls -l $@ |
||
64 | toby | 225 | file $@ |
2 | toby | 226 | |
8 | toby | 227 | # link Win32 DLL |
66 | toby | 228 | $(PLUGIN_W32) : exports.def $(OBJ_W32) |
8 | toby | 229 | $(DLLWRAP) -o $@ -def $^ -mwindows -s |
230 | ls -l $@ |
||
2 | toby | 231 | |
232 | |||
8 | toby | 233 | # -------------------- |