Subversion Repositories filter_foundry

Rev

Rev 2 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2 Rev 8
Line 1... Line 1...
1
# This file is part of "Filter Foundry", a filter plugin for Adobe Photoshop
1
# This file is part of ICOFormat, a File Format plugin for Adobe Photoshop
2
# Copyright (C) 2003-5 Toby Thain, toby@telegraphics.com.au
2
# Copyright (C) 2004-5 Toby Thain, toby@telegraphics.com.au
3
 
3
 
4
# This program is free software; you can redistribute it and/or modify
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  
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
6
# the Free Software Foundation; either version 2 of the License, or
7
# (at your option) any later version.
7
# (at your option) any later version.
Line 13... Line 13...
13
 
13
 
14
# You should have received a copy of the GNU General Public License  
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
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
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
 
17
 
18
# mingw32 Makefile
18
# GNU Makefile
-
 
19
# builds Win32 DLL and CS2/Mac Mach-O plugin bundle
19
 
20
 
-
 
21
# by Toby Thain <toby@telegraphics.com.au>
-
 
22
 
-
 
23
 
-
 
24
# ---------- variables & flags ----------
-
 
25
 
-
 
26
EXEC = FilterFoundry
-
 
27
 
20
CC = i386-mingw32msvc-gcc
28
MINGW_CC = i386-mingw32msvc-gcc
21
DLLWRAP = i386-mingw32msvc-dllwrap
29
DLLWRAP  = i386-mingw32msvc-dllwrap
22
WINDRES = i386-mingw32msvc-windres
30
WINDRES  = i386-mingw32msvc-windres
23
#CC = mingw32-gcc
-
 
24
#DLLWRAP = mingw32-dllwrap
-
 
25
#WINDRES = mingw32-windres
-
 
26
 
31
 
27
# use GNU flex and bison
32
# use GNU flex and bison
28
# these lines can be commented to use system lex and yacc
33
# these lines can be commented to use system lex and yacc
29
# although this may result in a larger overall executable
34
# although this may result in a larger overall executable
30
LEX = flex
35
LEX = flex
31
YACC = bison -y
36
YACC = bison -y
32
 
-
 
33
YFLAGS = -d
37
YFLAGS = -d
34
 
38
 
35
#PSAPI = "c:/program files/adobe/adobe photoshop 6.0 sdk/photoshopapi"
-
 
36
PSAPI = "../PhotoshopAPI"
39
PSAPI = ../PhotoshopAPI
-
 
40
 
37
CFLAGS += -O2 -DWIN_ENV \
41
CFLAGS += -Wall -O2
38
	-I$(PSAPI)/Pica_sp -I$(PSAPI)/Photoshop -I$(PSAPI)/General \
42
CPPFLAGS += -I$(PSAPI)/Pica_sp -I$(PSAPI)/Photoshop -I$(PSAPI)/General \
39
	-I../common/adobeplugin -I../common/tt
43
	-I../common/adobeplugin -I../common/tt
40
 
44
 
41
OBJ = main.o ui_win.o ui.o ui_build.o ui_build_win.o preview.o read.o save.o \
-
 
42
	parser.o lexer.o node.o symtab.o funcs.o trigtab.o process.o \
-
 
43
	load_win.o make_win.o make.o scripting.o \
-
 
44
	../common/tt/str.o ../common/tt/sprintf_tiny.o \
-
 
45
	../common/tt/ui_compat_win.o ../common/tt/file_compat_win.o \
-
 
46
	../common/tt/choosefile_win.o ../common/tt/compat_string.o \
-
 
47
	../common/tt/compat_win.o \
-
 
48
	../common/tt/dbg_win.o ../common/adobeplugin/dllmain.o \
-
 
49
	res.o
-
 
50
 
-
 
51
EXEC = dist/FilterFoundry.8bf
-
 
52
DISTARCHIVE = dist/FilterFoundry-win.zip
-
 
53
SRCARCHIVE = dist/FilterFoundry-src.zip
-
 
54
 
-
 
55
all : $(EXEC)
-
 
56
 
-
 
57
funcs.o : ff.h funcs.h symtab.h ui.h PARM.h parser.c
-
 
58
lexer.o : node.h symtab.h parser.c
-
 
59
load_mac.o : ff.h funcs.h symtab.h ui.h PARM.h
-
 
60
load_win.o : ff.h funcs.h symtab.h ui.h PARM.h
-
 
61
main.o : ff.h funcs.h symtab.h ui.h PARM.h node.h parser.h scripting.h
-
 
62
make.o : ff.h funcs.h symtab.h ui.h PARM.h
-
 
63
make_mac.o : ff.h funcs.h symtab.h ui.h PARM.h
-
 
64
make_win.o : ff.h funcs.h symtab.h ui.h PARM.h
-
 
65
node.o : node.h parser.c funcs.h symtab.h ui.h PARM.h
-
 
66
parser.o : node.h parser.h
-
 
67
preview.o : ff.h funcs.h symtab.h ui.h PARM.h node.h parser.h parser.c
-
 
68
process.o : ff.h funcs.h symtab.h ui.h PARM.h node.h parser.h
-
 
69
read.o : ff.h funcs.h symtab.h ui.h PARM.h
-
 
70
save.o : ff.h funcs.h symtab.h ui.h PARM.h
-
 
71
scripting.o : ff.h funcs.h symtab.h ui.h PARM.h scripting.h
-
 
72
symtab.o : symtab.h
-
 
73
ui.o : ff.h funcs.h symtab.h ui.h PARM.h node.h parser.h parser.c
-
 
74
ui_build.o : ff.h funcs.h symtab.h ui.h PARM.h
-
 
75
ui_build_win.o : ff.h funcs.h symtab.h ui.h PARM.h version.h
-
 
76
ui_mac.o : ff.h funcs.h symtab.h ui.h PARM.h
-
 
77
ui_win.o : ff.h funcs.h symtab.h ui.h PARM.h version.h
-
 
78
 
45
 
79
parser.o : node.h parser.h
46
# ---------- source & object files ----------
80
 
47
 
81
clean :
48
# where to find .c source files
82
	rm -f $(OBJ) $(EXEC) parser.c lexer.c $(DISTARCHIVE) $(SRCARCHIVE)
49
vpath %.c ../common/tt ../common/adobeplugin ../MoreFiles/Sources
83
 
50
 
84
dist : $(DISTARCHIVE)
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
85
 
58
 
86
$(DISTARCHIVE) : $(EXEC) dist/README.txt dist/COPYING.txt dist/examples
59
# derive lists of object files, separate for each platform
87
	zip -9 -r $@ $^
60
OBJ_OSX := $(patsubst %.c, obj/%.o,     $(SRC_COMMON) $(SRC_OSX))
88
	ls -l $@
61
OBJ_W32 := $(patsubst %.c, obj_w32/%.o, $(SRC_COMMON) $(SRC_W32))
89
 
62
 
90
src : $(SRCARCHIVE)
-
 
91
 
63
 
92
$(SRCARCHIVE) : \
-
 
93
		dist/README.txt dist/COPYING.txt dist/examples BUILDING.txt \
64
# ---------- executables ----------
-
 
65
 
94
		Makefile FilterFoundry.make cw7/filterfoundry_cw7.mcp \
66
# parts of Mac OS X plugin bundle to build
95
		funcs.c gentab.c load_mac.c load_win.c main.c make.c make_mac.c make_win.c \
-
 
96
		node.c preview.c process.c read.c save.c symtab.c trigtab.c \
67
# Adobe's plugs use .plugin extension
97
		ui.c ui_build.c ui_build_win.c ui_mac.c ui_win.c scripting.[chr] \
-
 
98
		lexer.[lc] parser.[yc] y.tab.h \
68
BUNDLE = $(EXEC)_cs2.plugin
99
		ff.h funcs.h node.h PARM.h parser.h resource.h symtab.h \
69
PLUGIN_OSX  = $(BUNDLE)/Contents/MacOS/$(EXEC)
100
		ui.h version.h \
-
 
101
		68k.r carbon.r classic.r universal.r pipl_common.r ui_mac.r  \
70
PLUGIN_RSRC = $(BUNDLE)/Contents/Resources/$(EXEC).rsrc
-
 
71
 
102
		PiPL.rc PiPL_body.rc ui_win.rc win_res.rc \
72
$(PLUGIN_OSX) : CPPFLAGS += -DMAC_ENV -DMACMACHO -Dmacintosh \
103
		caution.ico zoomin.ico zoomout.ico \
73
	-I/Developer/Headers/FlatCarbon \
104
		../common/tt/str.[ch] ../common/tt/sprintf_tiny.[ch] \
-
 
105
		../common/tt/dlg.[ch] ../common/tt/menu.[ch] \
74
	-I../MoreFiles/CHeaders -I../MoreFiles/Sources
106
		../common/tt/ui_compat.h ../common/tt/ui_compat_win.c ../common/tt/ui_compat_mac.c \
-
 
107
		../common/tt/file_compat.h ../common/tt/file_compat_win.c \
-
 
-
 
75
 
108
		../common/tt/compat_string.[ch] \
76
# Win32 plugin DLL to build
109
		../common/tt/compat_win.[ch] \
77
PLUGIN_W32 = $(EXEC).8bi
110
		../common/tt/dbg.h ../common/tt/dbg_mac.c ../common/tt/dbg_win.c \
-
 
111
		../common/tt/carbonstuff.h \
78
DISTARCHIVE = dist/$(EXEC)-win.zip
112
		../common/tt/choosefile.h ../common/tt/choosefile_win.c ../common/tt/choosefile_nav.c \
-
 
113
		../common/adobeplugin/dllmain.c ../common/adobeplugin/entry.h ../common/adobeplugin/world.h
-
 
-
 
79
 
114
	zip -r -9 $@ $^ -x \*/.DS_Store \*/.FBC\*
80
$(PLUGIN_W32) : CPPFLAGS += -DWIN_ENV
115
	ls -l $@
81
 
116
 
82
 
117
$(EXEC) : exports.def $(OBJ)
83
# ---------- targets ----------
-
 
84
 
-
 
85
# build everything
-
 
86
all : dll osx
-
 
87
 
-
 
88
dll : $(PLUGIN_W32)
-
 
89
 
-
 
90
osx : $(BUNDLE) $(PLUGIN_OSX) $(PLUGIN_RSRC) $(BUNDLE)/Contents/Info.plist
-
 
91
 
-
 
92
$(BUNDLE) :
-
 
93
	mkdir -p $@
-
 
94
	/Developer/Tools/SetFile -a B $(BUNDLE)
-
 
95
 
118
	$(DLLWRAP) -o $@ -def exports.def $(OBJ) -mwindows -s -Xlinker -M > dist/FilterFoundry.map
96
# insert correct executable name and version string in bundle's Info.plist
-
 
97
$(BUNDLE)/Contents/Info.plist : Info.plist version.h
-
 
98
	V=`sed -n -E 's/^.*VERSION_STR[[:blank:]]+\"([^"]*)\"/\1/p' version.h` ;\
-
 
99
		cat $< | sed s/VERSION_STR/$$V/ | sed s/EXEC/$(EXEC)/ > $@
-
 
100
 
119
	date
101
clean :
-
 
102
	rm -fr obj/* obj_w32/* $(PLUGIN_W32) $(BUNDLE) lex.yy.[ch] y.tab.[ch]
-
 
103
 
-
 
104
 
-
 
105
dist : $(DISTARCHIVE)
-
 
106
 
-
 
107
$(DISTARCHIVE) : $(PLUGIN_W32) dist/README.html dist/gpl.html
-
 
108
	zip -j -9 $@ $^
120
	ls -l $@
109
	ls -l $@
121
 
110
 
-
 
111
dist/gpl.html : 
-
 
112
	curl http://www.gnu.org/licenses/gpl.html | \
-
 
113
		sed 's%</HEAD>%<BASE HREF="http://www.gnu.org/"> </HEAD>%' > $@
-
 
114
 
-
 
115
 
-
 
116
# ---------- compile rules ----------
-
 
117
 
-
 
118
obj/%.o : %.c
-
 
119
	$(CC) -o $@ -c $< $(CFLAGS) $(CPPFLAGS)
-
 
120
obj_w32/%.o : %.c
-
 
121
	$(MINGW_CC) -o $@ -c $< $(CFLAGS) $(CPPFLAGS)
-
 
122
 
-
 
123
# note dependencies on version.h:
-
 
124
 
-
 
125
obj_w32/res.o : win_res.rc PiPL.rc PiPL_body.rc ui_win.rc caution.ico ui.h version.h
-
 
126
	$(WINDRES) -o $@ -i $< --language=0 $(CPPFLAGS)
-
 
127
 
-
 
128
lex.yy.c : lexer.l y.tab.c
-
 
129
	$(LEX) $<
-
 
130
y.tab.c : parser.y
-
 
131
	$(YACC) $< $(YFLAGS)
-
 
132
 
-
 
133
obj_w32/funcs.o : ff.h funcs.h symtab.h ui.h PARM.h y.tab.c
-
 
134
obj_w32/lex.yy.o : node.h symtab.h y.tab.c
-
 
135
obj_w32/load_win.o : ff.h funcs.h symtab.h ui.h PARM.h
-
 
136
obj_w32/main.o : ff.h funcs.h symtab.h ui.h PARM.h node.h scripting.h y.tab.c 
-
 
137
obj_w32/make.o : ff.h funcs.h symtab.h ui.h PARM.h
-
 
138
obj_w32/make_win.o : ff.h funcs.h symtab.h ui.h PARM.h
-
 
139
obj_w32/node.o : node.h y.tab.c funcs.h symtab.h ui.h PARM.h
-
 
140
obj_w32/y.tab.o : node.h y.tab.c
-
 
141
obj_w32/preview.o : ff.h funcs.h symtab.h ui.h PARM.h node.h y.tab.c
-
 
142
obj_w32/process.o : ff.h funcs.h symtab.h ui.h PARM.h node.h y.tab.c
-
 
143
obj_w32/read.o : ff.h funcs.h symtab.h ui.h PARM.h
-
 
144
obj_w32/save.o : ff.h funcs.h symtab.h ui.h PARM.h
-
 
145
obj_w32/scripting.o : ff.h funcs.h symtab.h ui.h PARM.h scripting.h
-
 
146
obj_w32/symtab.o : symtab.h
-
 
147
obj_w32/ui.o : ff.h funcs.h symtab.h ui.h PARM.h node.h y.tab.c
-
 
148
obj_w32/ui_build.o : ff.h funcs.h symtab.h ui.h PARM.h
-
 
149
obj_w32/ui_build_win.o : ff.h funcs.h symtab.h ui.h PARM.h version.h
-
 
150
obj_w32/ui_win.o : ff.h funcs.h symtab.h ui.h PARM.h version.h
-
 
151
 
-
 
152
obj/funcs.o : ff.h funcs.h symtab.h ui.h PARM.h y.tab.c
-
 
153
obj/lex.yy.o : node.h symtab.h y.tab.c
-
 
154
obj/load_mac.o : ff.h funcs.h symtab.h ui.h PARM.h
-
 
155
obj/main.o : ff.h funcs.h symtab.h ui.h PARM.h node.h scripting.h y.tab.c 
-
 
156
obj/make.o : ff.h funcs.h symtab.h ui.h PARM.h
-
 
157
obj/make_mac.o : ff.h funcs.h symtab.h ui.h PARM.h
-
 
158
obj/node.o : node.h y.tab.c funcs.h symtab.h ui.h PARM.h
-
 
159
obj/y.tab.o : node.h y.tab.c
-
 
160
obj/preview.o : ff.h funcs.h symtab.h ui.h PARM.h node.h y.tab.c
-
 
161
obj/process.o : ff.h funcs.h symtab.h ui.h PARM.h node.h y.tab.c
-
 
162
obj/read.o : ff.h funcs.h symtab.h ui.h PARM.h
-
 
163
obj/save.o : ff.h funcs.h symtab.h ui.h PARM.h
-
 
164
obj/scripting.o : ff.h funcs.h symtab.h ui.h PARM.h scripting.h
-
 
165
obj/symtab.o : symtab.h
-
 
166
obj/ui.o : ff.h funcs.h symtab.h ui.h PARM.h node.h y.tab.c
-
 
167
obj/ui_build.o : ff.h funcs.h symtab.h ui.h PARM.h
-
 
168
obj/ui_mac.o : ff.h funcs.h symtab.h ui.h PARM.h
-
 
169
 
-
 
170
gentab : gentab.c funcs.h ; $(CC) -o $@ $< -lm
-
 
171
trigtab.c : gentab ; ./gentab > $@
-
 
172
 
-
 
173
# compile Mac resources (into data fork of .rsrc file)
-
 
174
$(PLUGIN_RSRC) : PiPL_macho.r ui_mac.r scripting.r ui.h version.h
122
test : $(EXEC)
175
	mkdir -p $(dir $@)
-
 
176
	/Developer/Tools/Rez -o $@ -useDF $(filter %.r,$^) \
-
 
177
		-i /Developer/Headers/FlatCarbon \
-
 
178
		-i $(PSAPI)/Resources \
123
	cp $(EXEC) ../../pcshare
179
		-i $(PSAPI)/Photoshop
-
 
180
	ls -l $@
124
 
181
 
125
res.o : win_res.rc PiPL.rc PiPL_body.rc ui_win.rc caution.ico
-
 
126
	$(WINDRES) --language=0 --include-dir=$(PSAPI)/Photoshop --include-dir=$(PSAPI)/Pica_sp -i win_res.rc -o $@
-
 
127
 
182
 
128
lexer.o : lexer.l parser.c
183
# ---------- link rules ----------
129
 
184
 
-
 
185
# link OS X Mach-O executable
-
 
186
$(PLUGIN_OSX) : exports.exp $(OBJ_OSX) $(PLUGIN_RSRC)
130
parser.o : parser.y
187
	mkdir -p $(dir $@)
-
 
188
	$(CC) -bundle -o $@ $(OBJ_OSX) -exported_symbols_list exports.exp \
-
 
189
		-framework Carbon -framework System
-
 
190
	ls -l $@
131
 
191
 
132
gentab : gentab.c funcs.h
192
# link Win32 DLL
-
 
193
$(PLUGIN_W32) : exports.def $(OBJ_W32) obj_w32/res.o
133
	gcc -o gentab gentab.c -lm
194
	$(DLLWRAP) -o $@ -def $^ -mwindows -s
-
 
195
	ls -l $@
134
 
196
 
135
trigtab.c : gentab
-
 
136
	./gentab > $@
-
 
137
 
197
 
138
#CC=gcc
-
 
139
#CFLAGS=-DDEBUG -DPARSERTEST
-
 
140
parsertest : lexer.o parser.o node.o testmain.o symtab.o funcs.o
-
 
141
	$(CC) -o $@ $^ -lm
198
# --------------------