Subversion Repositories filter_foundry

Rev

Rev 2 | Rev 9 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
8 toby 1
# This file is part of ICOFormat, a File Format plugin for Adobe Photoshop
2
# Copyright (C) 2004-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
 
2 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
35
LEX = flex
36
YACC = bison -y
37
YFLAGS = -d
38
 
8 toby 39
PSAPI = ../PhotoshopAPI
40
 
41
CFLAGS += -Wall -O2
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))
61
OBJ_W32 := $(patsubst %.c, obj_w32/%.o, $(SRC_COMMON) $(SRC_W32))
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
 
72
$(PLUGIN_OSX) : CPPFLAGS += -DMAC_ENV -DMACMACHO -Dmacintosh \
73
	-I/Developer/Headers/FlatCarbon \
74
	-I../MoreFiles/CHeaders -I../MoreFiles/Sources
75
 
76
# Win32 plugin DLL to build
77
PLUGIN_W32 = $(EXEC).8bi
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
 
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
 
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
 
2 toby 101
clean :
8 toby 102
	rm -fr obj/* obj_w32/* $(PLUGIN_W32) $(BUNDLE) lex.yy.[ch] y.tab.[ch]
2 toby 103
 
8 toby 104
 
2 toby 105
dist : $(DISTARCHIVE)
106
 
8 toby 107
$(DISTARCHIVE) : $(PLUGIN_W32) dist/README.html dist/gpl.html
108
	zip -j -9 $@ $^
2 toby 109
	ls -l $@
110
 
8 toby 111
dist/gpl.html : 
112
	curl http://www.gnu.org/licenses/gpl.html | \
113
		sed 's%</HEAD>%<BASE HREF="http://www.gnu.org/"> </HEAD>%' > $@
2 toby 114
 
115
 
8 toby 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
175
	mkdir -p $(dir $@)
176
	/Developer/Tools/Rez -o $@ -useDF $(filter %.r,$^) \
177
		-i /Developer/Headers/FlatCarbon \
178
		-i $(PSAPI)/Resources \
179
		-i $(PSAPI)/Photoshop
2 toby 180
	ls -l $@
181
 
182
 
8 toby 183
# ---------- link rules ----------
2 toby 184
 
8 toby 185
# link OS X Mach-O executable
186
$(PLUGIN_OSX) : exports.exp $(OBJ_OSX) $(PLUGIN_RSRC)
187
	mkdir -p $(dir $@)
188
	$(CC) -bundle -o $@ $(OBJ_OSX) -exported_symbols_list exports.exp \
189
		-framework Carbon -framework System
190
	ls -l $@
2 toby 191
 
8 toby 192
# link Win32 DLL
193
$(PLUGIN_W32) : exports.def $(OBJ_W32) obj_w32/res.o
194
	$(DLLWRAP) -o $@ -def $^ -mwindows -s
195
	ls -l $@
2 toby 196
 
197
 
8 toby 198
# --------------------