Rev 65 | Rev 67 | 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 | |||
28 | MINGW_CC = i386-mingw32msvc-gcc |
||
29 | DLLWRAP = i386-mingw32msvc-dllwrap |
||
30 | WINDRES = i386-mingw32msvc-windres |
||
31 | |||
52 | toby | 32 | # use GNU flex and bison |
33 | # these lines can be commented to use system lex and yacc |
||
34 | # although this may result in a larger overall executable |
||
2 | toby | 35 | LEX = flex |
36 | YACC = bison -y |
||
37 | YFLAGS = -d |
||
38 | |||
64 | toby | 39 | PSAPI = "../Adobe Photoshop CS3 Public Beta SDK/photoshopapi" |
8 | toby | 40 | |
23 | toby | 41 | CFLAGS += -O2 -W -Wall -Wno-main -Wno-unused-parameter -Wno-multichar |
8 | toby | 42 | CPPFLAGS += -I$(PSAPI)/Pica_sp -I$(PSAPI)/Photoshop -I$(PSAPI)/General \ |
2 | toby | 43 | -I../common/adobeplugin -I../common/tt |
44 | |||
45 | |||
8 | toby | 46 | # ---------- source & object files ---------- |
2 | toby | 47 | |
8 | toby | 48 | # where to find .c source files |
49 | vpath %.c ../common/tt ../common/adobeplugin ../MoreFiles/Sources |
||
2 | toby | 50 | |
8 | toby | 51 | # list of source files |
52 | SRC_COMMON = main.c funcs.c trigtab.c process.c node.c symtab.c sprintf_tiny.c \ |
||
53 | ui.c ui_build.c preview.c read.c save.c make.c scripting.c y.tab.c lex.yy.c str.c |
||
54 | SRC_OSX = dbg_mac.c ui_mac.c make_mac.c load_mac.c ui_compat_mac.c choosefile_nav.c \ |
||
55 | MoreFilesExtras.c MoreFiles.c MoreDesktopMgr.c FileCopy.c Search.c |
||
56 | SRC_W32 = dbg_win.c ui_win.c make_win.c load_win.c ui_compat_win.c choosefile_win.c \ |
||
57 | ui_build_win.c compat_string.c compat_win.c file_compat_win.c dllmain.c |
||
2 | toby | 58 | |
8 | toby | 59 | # derive lists of object files, separate for each platform |
60 | OBJ_OSX := $(patsubst %.c, obj/%.o, $(SRC_COMMON) $(SRC_OSX)) |
||
66 | toby | 61 | OBJ_W32 := $(patsubst %.c, obj_w32/%.o, $(SRC_COMMON) $(SRC_W32)) obj_w32/res.o |
2 | toby | 62 | |
8 | toby | 63 | |
64 | # ---------- executables ---------- |
||
65 | |||
66 | # parts of Mac OS X plugin bundle to build |
||
67 | # Adobe's plugs use .plugin extension |
||
68 | BUNDLE = $(EXEC)_cs2.plugin |
||
69 | PLUGIN_OSX = $(BUNDLE)/Contents/MacOS/$(EXEC) |
||
70 | PLUGIN_RSRC = $(BUNDLE)/Contents/Resources/$(EXEC).rsrc |
||
71 | |||
66 | toby | 72 | $(PLUGIN_OSX) : CPPFLAGS += -DMAC_ENV -Dmacintosh \ |
8 | toby | 73 | -I/Developer/Headers/FlatCarbon \ |
74 | -I../MoreFiles/CHeaders -I../MoreFiles/Sources |
||
75 | |||
76 | # Win32 plugin DLL to build |
||
23 | toby | 77 | PLUGIN_W32 = $(EXEC).8bf |
8 | toby | 78 | DISTARCHIVE = dist/$(EXEC)-win.zip |
79 | |||
80 | $(PLUGIN_W32) : CPPFLAGS += -DWIN_ENV |
||
81 | |||
82 | |||
83 | # ---------- targets ---------- |
||
84 | |||
85 | # build everything |
||
86 | all : dll osx |
||
87 | |||
88 | dll : $(PLUGIN_W32) |
||
89 | |||
66 | toby | 90 | osx fat : $(BUNDLE) $(PLUGIN_OSX) $(PLUGIN_RSRC) $(BUNDLE)/Contents/Info.plist $(BUNDLE)/Contents/PkgInfo |
8 | toby | 91 | |
64 | toby | 92 | # See: http://developer.apple.com/documentation/Porting/Conceptual/PortingUnix/compiling/chapter_4_section_3.html#//apple_ref/doc/uid/TP40002850-BAJCFEBA |
93 | fat : CFLAGS += -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386 |
||
94 | fat : LDFLAGS += -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386 |
||
95 | fat : REZFLAGS += -arch ppc -arch i386 |
||
96 | |||
8 | toby | 97 | $(BUNDLE) : |
98 | mkdir -p $@ |
||
66 | toby | 99 | /Developer/Tools/SetFile -a B $@ |
11 | toby | 100 | /Developer/Tools/SetFile -t TEXT -c ttxt dist/examples/*.afs |
8 | toby | 101 | |
102 | # insert correct executable name and version string in bundle's Info.plist |
||
65 | toby | 103 | $(BUNDLE)/Contents/Info.plist : Info.plist $(BUNDLE) version.h |
64 | toby | 104 | mkdir -p $(dir $@) |
8 | toby | 105 | V=`sed -n -E 's/^.*VERSION_STR[[:blank:]]+\"([^"]*)\"/\1/p' version.h` ;\ |
52 | toby | 106 | sed -e s/VERSION_STR/$$V/ -e s/EXEC/$(EXEC)/ $< > $@ |
8 | toby | 107 | |
66 | toby | 108 | $(BUNDLE)/Contents/PkgInfo : $(BUNDLE) |
109 | mkdir -p $(dir $@) |
||
110 | echo -n 8BIF8BIM > $@ |
||
111 | |||
2 | toby | 112 | clean : |
66 | toby | 113 | rm -fr *.[ox] $(OBJ_OSX) $(OBJ_W32) $(PLUGIN_W32) $(BUNDLE) \ |
18 | toby | 114 | gentab trigtab.c lex.yy.[ch] y.tab.[ch] temp |
2 | toby | 115 | |
8 | toby | 116 | |
2 | toby | 117 | dist : $(DISTARCHIVE) |
118 | |||
28 | toby | 119 | $(DISTARCHIVE) : $(PLUGIN_W32) dist/README.html dist/gpl.html dist/examples/*.afs |
20 | toby | 120 | zip -j -9 -r $@ $^ |
2 | toby | 121 | ls -l $@ |
122 | |||
8 | toby | 123 | dist/gpl.html : |
124 | curl http://www.gnu.org/licenses/gpl.html | \ |
||
66 | toby | 125 | sed -e 's%</HEAD>%<BASE HREF="http://www.gnu.org/"> </HEAD>%' \ |
126 | -e 's%</head>%<BASE HREF="http://www.gnu.org/"> </HEAD>%' > $@ |
||
2 | toby | 127 | |
128 | |||
8 | toby | 129 | # ---------- compile rules ---------- |
130 | |||
131 | obj/%.o : %.c |
||
9 | toby | 132 | $(CC) -o $@ -c $< $(CFLAGS) $(CPPFLAGS) -fpascal-strings |
8 | toby | 133 | obj_w32/%.o : %.c |
134 | $(MINGW_CC) -o $@ -c $< $(CFLAGS) $(CPPFLAGS) |
||
135 | |||
136 | # note dependencies on version.h: |
||
137 | |||
138 | obj_w32/res.o : win_res.rc PiPL.rc PiPL_body.rc ui_win.rc caution.ico ui.h version.h |
||
139 | $(WINDRES) -o $@ -i $< --language=0 $(CPPFLAGS) |
||
140 | |||
141 | lex.yy.c : lexer.l y.tab.c |
||
142 | $(LEX) $< |
||
143 | y.tab.c : parser.y |
||
144 | $(YACC) $< $(YFLAGS) |
||
145 | |||
146 | obj_w32/funcs.o : ff.h funcs.h symtab.h ui.h PARM.h y.tab.c |
||
147 | obj_w32/lex.yy.o : node.h symtab.h y.tab.c |
||
148 | obj_w32/load_win.o : ff.h funcs.h symtab.h ui.h PARM.h |
||
149 | obj_w32/main.o : ff.h funcs.h symtab.h ui.h PARM.h node.h scripting.h y.tab.c |
||
150 | obj_w32/make.o : ff.h funcs.h symtab.h ui.h PARM.h |
||
151 | obj_w32/make_win.o : ff.h funcs.h symtab.h ui.h PARM.h |
||
152 | obj_w32/node.o : node.h y.tab.c funcs.h symtab.h ui.h PARM.h |
||
153 | obj_w32/y.tab.o : node.h y.tab.c |
||
154 | obj_w32/preview.o : ff.h funcs.h symtab.h ui.h PARM.h node.h y.tab.c |
||
155 | obj_w32/process.o : ff.h funcs.h symtab.h ui.h PARM.h node.h y.tab.c |
||
156 | obj_w32/read.o : ff.h funcs.h symtab.h ui.h PARM.h |
||
157 | obj_w32/save.o : ff.h funcs.h symtab.h ui.h PARM.h |
||
158 | obj_w32/scripting.o : ff.h funcs.h symtab.h ui.h PARM.h scripting.h |
||
159 | obj_w32/symtab.o : symtab.h |
||
160 | obj_w32/ui.o : ff.h funcs.h symtab.h ui.h PARM.h node.h y.tab.c |
||
161 | obj_w32/ui_build.o : ff.h funcs.h symtab.h ui.h PARM.h |
||
162 | obj_w32/ui_build_win.o : ff.h funcs.h symtab.h ui.h PARM.h version.h |
||
163 | obj_w32/ui_win.o : ff.h funcs.h symtab.h ui.h PARM.h version.h |
||
164 | |||
165 | obj/funcs.o : ff.h funcs.h symtab.h ui.h PARM.h y.tab.c |
||
166 | obj/lex.yy.o : node.h symtab.h y.tab.c |
||
167 | obj/load_mac.o : ff.h funcs.h symtab.h ui.h PARM.h |
||
168 | obj/main.o : ff.h funcs.h symtab.h ui.h PARM.h node.h scripting.h y.tab.c |
||
169 | obj/make.o : ff.h funcs.h symtab.h ui.h PARM.h |
||
170 | obj/make_mac.o : ff.h funcs.h symtab.h ui.h PARM.h |
||
171 | obj/node.o : node.h y.tab.c funcs.h symtab.h ui.h PARM.h |
||
172 | obj/y.tab.o : node.h y.tab.c |
||
173 | obj/preview.o : ff.h funcs.h symtab.h ui.h PARM.h node.h y.tab.c |
||
174 | obj/process.o : ff.h funcs.h symtab.h ui.h PARM.h node.h y.tab.c |
||
175 | obj/read.o : ff.h funcs.h symtab.h ui.h PARM.h |
||
176 | obj/save.o : ff.h funcs.h symtab.h ui.h PARM.h |
||
177 | obj/scripting.o : ff.h funcs.h symtab.h ui.h PARM.h scripting.h |
||
178 | obj/symtab.o : symtab.h |
||
179 | obj/ui.o : ff.h funcs.h symtab.h ui.h PARM.h node.h y.tab.c |
||
180 | obj/ui_build.o : ff.h funcs.h symtab.h ui.h PARM.h |
||
181 | obj/ui_mac.o : ff.h funcs.h symtab.h ui.h PARM.h |
||
182 | |||
183 | gentab : gentab.c funcs.h ; $(CC) -o $@ $< -lm |
||
184 | trigtab.c : gentab ; ./gentab > $@ |
||
185 | |||
186 | # compile Mac resources (into data fork of .rsrc file) |
||
64 | toby | 187 | $(PLUGIN_RSRC) : $(BUNDLE) PiPL_macho.r ui_mac.r scripting.r ui.h version.h |
8 | toby | 188 | mkdir -p $(dir $@) |
64 | toby | 189 | /Developer/Tools/Rez -o $@ -useDF $(REZFLAGS) $(filter %.r,$^) \ |
8 | toby | 190 | -i /Developer/Headers/FlatCarbon \ |
191 | -i $(PSAPI)/Resources \ |
||
192 | -i $(PSAPI)/Photoshop |
||
2 | toby | 193 | ls -l $@ |
194 | |||
195 | |||
8 | toby | 196 | # ---------- link rules ---------- |
2 | toby | 197 | |
8 | toby | 198 | # link OS X Mach-O executable |
66 | toby | 199 | $(PLUGIN_OSX) : $(BUNDLE) exports.exp $(OBJ_OSX) |
8 | toby | 200 | mkdir -p $(dir $@) |
64 | toby | 201 | $(CC) -bundle -o $@ $(OBJ_OSX) \ |
202 | $(LDFLAGS) -exported_symbols_list exports.exp \ |
||
8 | toby | 203 | -framework Carbon -framework System |
204 | ls -l $@ |
||
64 | toby | 205 | file $@ |
2 | toby | 206 | |
8 | toby | 207 | # link Win32 DLL |
66 | toby | 208 | $(PLUGIN_W32) : exports.def $(OBJ_W32) |
8 | toby | 209 | $(DLLWRAP) -o $@ -def $^ -mwindows -s |
210 | ls -l $@ |
||
2 | toby | 211 | |
212 | |||
8 | toby | 213 | # -------------------- |