# This file is part of pathtotext, a Filter plugin for Adobe Illustrator # Copyright (C) 2005-9 Toby Thain, toby@telegraphics.com.au # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # GNU Makefile # using gcc: builds Mac OS X Mach-O plugin for Adobe Illustrator CS2 # using MinGW (gcc cross-compiler): a Win32 DLL plugin # (DLL should be backwards compatible with Illustrator 8.0 if using v8/9/10 SDK, # or Illustrator 7.0 if using v7 SDK) # (Carbon bundle format plugins for Illustrator 10 on Mac OS X # can be built with Apple MPW, or CodeWarrior.) # by Toby Thain # ---------- variables & flags ---------- EXEC = pathtotext DISTARCHIVE = pathtotext-win.zip # assumes MinGW binaries are found in a directory on your PATH # (e.g., in my case, 'export PATH=$PATH:/opt/mingw/bin' is in my ~/.bash_profile) MINGW_CXX = i386-mingw32msvc-g++ DLLWRAP = i386-mingw32msvc-dllwrap WINDRES = i386-mingw32msvc-windres # where to find CS2 SDK APICS2 = ../aics2sdkw/IllustratorAPI # where to find AI7 SDK API7 = ../Illustrator70.SDK/AIPluginAPI # where to find PS SDK PSAPI = ../PhotoshopAPI CPPFLAGS += -DISFILTER CXXFLAGS += -Wextra -Wall -Wno-unknown-pragmas -O2 CPPFLAGS += -I../common/adobeplugin -I../common/tt -I$(PSAPI)/Photoshop # ---------- source & object files ---------- # where to find .c source files vpath %.c ../common/tt ../common/adobeplugin # list of source files SRC_COMMON = aipluginmain.c main.c str.c SRC_OSX = dbg_mac.c choosefile_nav.c SRC_W32 = dbg_win.c choosefile_win.c file_compat_win.c # derive lists of object files, separate for each platform OBJ_OSX := $(patsubst %.c, obj/%.o, $(SRC_COMMON) $(SRC_OSX)) OBJ_W32 := $(patsubst %.c, obj_w32/%.o, $(SRC_COMMON) $(SRC_W32)) # ---------- executables ---------- # parts of Mac OS X plugin bundle to build # .bundle is a good generic extension, but Adobe's plugs use .aip BUNDLE = $(EXEC).aip PLUGIN_OSX = $(BUNDLE)/Contents/MacOS/$(EXEC) PLUGIN_RSRC = $(BUNDLE)/Contents/Resources/$(EXEC).rsrc # use CS2 API for the OS X Mach-O build $(PLUGIN_OSX) : CPPFLAGS += \ -DMAC_ENV -DMACMACHO -Dmacintosh \ -I/Developer/Headers/FlatCarbon \ -I$(APICS2)/Illustrator \ -I$(APICS2)/Illustrator/legacy \ -I$(APICS2)/PICA_SP \ -I$(APICS2)/ADM \ -I$(APICS2)/ADM/legacy # Win32 plugin DLL to build PLUGIN_W32 = $(EXEC).aip # use AI7 API for Win32 build (cos I can only test with v8 right now :) $(PLUGIN_W32) : CPPFLAGS += \ -DWIN_ENV \ -I$(API7)/"ADM Headers" -I$(API7)/"Adobe Illustrator Headers" \ -I$(API7)/"General Headers" -I$(API7)/"Legacy Headers" \ -I$(API7)/"PICA SP Headers" -I$(API7)/"Undocumented Headers" # ---------- targets ---------- # build everything all : dll osx dll : $(PLUGIN_W32) osx : $(BUNDLE) $(PLUGIN_OSX) $(PLUGIN_RSRC) $(BUNDLE)/Contents/Info.plist $(BUNDLE) : mkdir -p $@ /Developer/Tools/SetFile -a B $@ # insert correct executable name and version string in bundle's Info.plist $(BUNDLE)/Contents/Info.plist : Info.plist version.h V=`sed -n -E 's/^.*VERSION_STR[[:blank:]]+\"([^"]*)\"/\1/p' version.h` ;\ cat $< | sed -e s/VERSION_STR/$$V/ -e s/EXEC/$(EXEC)/ > $@ dist : $(DISTARCHIVE) $(DISTARCHIVE) : $(PLUGIN_W32) README.txt COPYING.txt zip -9 $@ $^ ls -l $@ clean : rm -fr obj/* obj_w32/* $(PLUGIN_W32) $(BUNDLE) # ---------- compile rules ---------- obj/%.o : %.c $(CXX) -o $@ -c $< $(CXXFLAGS) $(CPPFLAGS) obj_w32/%.o : %.c $(MINGW_CXX) -o $@ -c $< $(CXXFLAGS) $(CPPFLAGS) # compile Windows 'PIPL' resource (including version info) obj_w32/res.o : PiPL.rc version.h $(WINDRES) -i $< -o $@ obj/main.o : common.h version.h obj_w32/main.o : common.h version.h # compile Mac resources (into data fork of .rsrc file) $(PLUGIN_RSRC) : PiPL_macho.r mkdir -p $(dir $@) /Developer/Tools/Rez -o $@ $^ -useDF ls -l $@ # ---------- link rules ---------- # final link step for OS X Mach-O executable $(PLUGIN_OSX) : exports.exp $(OBJ_OSX) $(PLUGIN_RSRC) mkdir -p $(dir $@) $(CXX) -bundle -o $@ $(OBJ_OSX) -exported_symbols_list exports.exp \ -framework Carbon -framework System ls -l $@ # final link step for Win32 DLL $(PLUGIN_W32) : exports.def $(OBJ_W32) obj_w32/res.o $(DLLWRAP) -o $@ -def $^ --driver-name=$(MINGW_CXX) -s -mwindows ls -l $@ # --------------------