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 |
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 \ |
||
45 | -I../common/adobeplugin -I../common/tt |
||
2 | toby | 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 |
135 | dmarschall | 54 | SRC_COMMON = main.c funcs.c process.c node.c symtab.c \ |
103 | toby | 55 | ui.c ui_build.c preview.c read.c save.c make.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 \ |
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) \ |
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 |
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 |
||
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 |
8 | toby | 165 | $(LEX) $< |
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 |
174 | obj_w32/make_win.o : ff.h funcs.h symtab.h ui.h PARM.h |
||
113 | dmarschall | 175 | obj_w32/versioninfo_modify_win.o : ff.h funcs.h symtab.h ui.h PARM.h |
70 | toby | 176 | obj_w32/node.o : node.h y.tab.h funcs.h symtab.h ui.h PARM.h |
177 | obj_w32/y.tab.o : node.h y.tab.h |
||
178 | obj_w32/preview.o : ff.h funcs.h symtab.h ui.h PARM.h node.h y.tab.h |
||
179 | obj_w32/process.o : ff.h funcs.h symtab.h ui.h PARM.h node.h y.tab.h |
||
8 | toby | 180 | obj_w32/read.o : ff.h funcs.h symtab.h ui.h PARM.h |
181 | obj_w32/save.o : ff.h funcs.h symtab.h ui.h PARM.h |
||
182 | obj_w32/scripting.o : ff.h funcs.h symtab.h ui.h PARM.h scripting.h |
||
183 | obj_w32/symtab.o : symtab.h |
||
70 | toby | 184 | obj_w32/ui.o : ff.h funcs.h symtab.h ui.h PARM.h node.h y.tab.h |
8 | toby | 185 | obj_w32/ui_build.o : ff.h funcs.h symtab.h ui.h PARM.h |
186 | obj_w32/ui_build_win.o : ff.h funcs.h symtab.h ui.h PARM.h version.h |
||
187 | obj_w32/ui_win.o : ff.h funcs.h symtab.h ui.h PARM.h version.h |
||
159 | dmarschall | 188 | obj_w32/manifest.o : manifest.h |
8 | toby | 189 | |
70 | toby | 190 | obj/funcs.o : ff.h funcs.h symtab.h ui.h PARM.h y.tab.h |
191 | obj/lex.yy.o : node.h symtab.h y.tab.h |
||
8 | toby | 192 | obj/load_mac.o : ff.h funcs.h symtab.h ui.h PARM.h |
70 | toby | 193 | obj/main.o : ff.h funcs.h symtab.h ui.h PARM.h node.h scripting.h y.tab.h |
8 | toby | 194 | obj/make.o : ff.h funcs.h symtab.h ui.h PARM.h |
195 | obj/make_mac.o : ff.h funcs.h symtab.h ui.h PARM.h |
||
70 | toby | 196 | obj/node.o : node.h y.tab.h funcs.h symtab.h ui.h PARM.h |
197 | obj/y.tab.o : node.h symtab.h y.tab.h |
||
198 | obj/preview.o : ff.h funcs.h symtab.h ui.h PARM.h node.h y.tab.h |
||
199 | obj/process.o : ff.h funcs.h symtab.h ui.h PARM.h node.h y.tab.h |
||
8 | toby | 200 | obj/read.o : ff.h funcs.h symtab.h ui.h PARM.h |
201 | obj/save.o : ff.h funcs.h symtab.h ui.h PARM.h |
||
202 | obj/scripting.o : ff.h funcs.h symtab.h ui.h PARM.h scripting.h |
||
203 | obj/symtab.o : symtab.h |
||
70 | toby | 204 | obj/ui.o : ff.h funcs.h symtab.h ui.h PARM.h node.h y.tab.h |
8 | toby | 205 | obj/ui_build.o : ff.h funcs.h symtab.h ui.h PARM.h |
206 | obj/ui_mac.o : ff.h funcs.h symtab.h ui.h PARM.h |
||
207 | |||
208 | # compile Mac resources (into data fork of .rsrc file) |
||
64 | toby | 209 | $(PLUGIN_RSRC) : $(BUNDLE) PiPL_macho.r ui_mac.r scripting.r ui.h version.h |
8 | toby | 210 | mkdir -p $(dir $@) |
64 | toby | 211 | /Developer/Tools/Rez -o $@ -useDF $(REZFLAGS) $(filter %.r,$^) \ |
8 | toby | 212 | -i /Developer/Headers/FlatCarbon \ |
213 | -i $(PSAPI)/Resources \ |
||
214 | -i $(PSAPI)/Photoshop |
||
2 | toby | 215 | ls -l $@ |
216 | |||
217 | |||
8 | toby | 218 | # ---------- link rules ---------- |
2 | toby | 219 | |
8 | toby | 220 | # link OS X Mach-O executable |
66 | toby | 221 | $(PLUGIN_OSX) : $(BUNDLE) exports.exp $(OBJ_OSX) |
8 | toby | 222 | mkdir -p $(dir $@) |
64 | toby | 223 | $(CC) -bundle -o $@ $(OBJ_OSX) \ |
224 | $(LDFLAGS) -exported_symbols_list exports.exp \ |
||
8 | toby | 225 | -framework Carbon -framework System |
226 | ls -l $@ |
||
64 | toby | 227 | file $@ |
2 | toby | 228 | |
8 | toby | 229 | # link Win32 DLL |
66 | toby | 230 | $(PLUGIN_W32) : exports.def $(OBJ_W32) |
8 | toby | 231 | $(DLLWRAP) -o $@ -def $^ -mwindows -s |
232 | ls -l $@ |
||
2 | toby | 233 | |
234 | |||
8 | toby | 235 | # -------------------- |