Subversion Repositories filter_foundry

Rev

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