# This file is part of patharea, a Filter plugin for Adobe(R) Illustrator(R) # Copyright (C) 2005-2013 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 # Builds the plugin for Illustrator CS6/Mac, with a Cocoa UI. # May also work with earlier versions if appropriate SDK and target # is specified. # by Toby Thain # ---------- variables & flags ---------- EXEC = PathArea VERSION := $(shell sed -n -E 's/^.*VERSION_STR[[:blank:]]+\"([^"]*)\"/\1/p' version.h) # where to find API in appropriate version of SDK (Mac OS X build) API = "../Adobe Illustrator CS6 SDK/illustratorapi" SDK = -I$(API)/illustrator -I$(API)/illustrator/legacy \ -I$(API)/pica_sp \ -I$(API)/adm -I$(API)/adm/legacy \ -I$(API)/ate CFLAGS += -Wno-unknown-pragmas -O2 CXXFLAGS += $(CFLAGS) CPPFLAGS += -DISFILTER -I../common/adobeplugin -I../common/tt $(SDK) REZFLAGS += $(ARCH) \ -d TARGET=\"$(TARGET)\" \ -d PIPL_PLUGIN_NAME=\"$(EXEC)\" \ -i ../common/adobeplugin/aics3 # ---------- source & object files ---------- # where to find .c source files vpath %.c ../common/tt ../common/adobeplugin OBJ_OSX := $(addprefix obj/, aipluginmain.o main.o str.o dbg_mac.o ui_cocoa.o) # ---------- executables ---------- BUNDLE = $(EXEC).aip PLUGIN_OSX = $(BUNDLE)/Contents/MacOS/$(EXEC) PLUGIN_RSRC = $(BUNDLE)/Contents/Resources/$(EXEC).rsrc PLUGIN_PARTS = $(PLUGIN_OSX) $(PLUGIN_RSRC) $(BUNDLE)/Contents/Info.plist $(BUNDLE)/Contents/PkgInfo SHORTTARGET := $(shell grep -s -o 'CS[0-9,]' $(BUNDLE)/Contents/Info.plist) DISTDMG = dist/$(EXEC)-$(SHORTTARGET)-$(VERSION).dmg $(PLUGIN_OSX) : CPPFLAGS += -DMAC_ENV -DMACMACHO -I/Developer/Headers/FlatCarbon -I../common/adobeplugin $(PLUGIN_OSX) : CXXFLAGS += $(ARCH) $(PLUGIN_OSX) : LDFLAGS += $(ARCH) # ---------- targets ---------- # 'thin' means build with default architecture and OS X SDK only. # It's the default target for convenience, but you will want to choose # a specific Illustrator version & Illustrator SDK for a release build. .PHONY : thin cs2 cs3 cs5 cs6 clean dmg thin cs2 cs3 cs5 cs6 : $(PLUGIN_PARTS) # See: http://developer.apple.com/documentation/Porting/Conceptual/PortingUnix/compiling/chapter_4_section_3.html#//apple_ref/doc/uid/TP40002850-BAJCFEBA # Note that OS X SDKs may be installed under /SDKs rather than /Developer/SDKs # CS2 Min system req: 10.2.8, 10.3 + G4/G5 cs2 : ARCH = -arch ppc cs2 : CXXFLAGS += -isystem /Developer/SDKs/MacOSX10.2.8.sdk cs2 : LDFLAGS += -Wl,-syslibroot,/Developer/SDKs/MacOSX10.2.8.sdk cs2 : TARGET = "Built for Illustrator CS2 (PowerPC)" # CS3 Min system req: 10.4.8, 10.5 + G4/G5/Intel # CS4 Min system req: 10.4.11, 10.5.4 + G4/G5/Intel cs3 : ARCH = -arch ppc -arch i386 cs3 : CXXFLAGS += -isysroot /Developer/SDKs/MacOSX10.4u.sdk cs3 : LDFLAGS += -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk cs3 : TARGET = "For Illustrator CS3,4 (Intel, PowerPC)" # CS5 Min system req: 10.5.7, 10.6 + Intel cs5 : ARCH = -arch i386 cs5 : CXXFLAGS += -isysroot /Developer/SDKs/MacOSX10.5.sdk cs5 : LDFLAGS += -Wl,-syslibroot,/Developer/SDKs/MacOSX10.5.sdk cs5 : TARGET = "For Illustrator CS5 (Intel)" # CS6 Min system req: 10.6.8, 10.7 + Intel 64 bit cs6 : ARCH = -arch x86_64 cs6 : TARGET = "For Illustrator CS6 (Intel 64-bit)" $(BUNDLE) : mkdir $@ /Developer/Tools/SetFile -a B $@ # insert correct executable name and version string in bundle's Info.plist $(BUNDLE)/Contents/Info.plist : Info.plist.tmpl version.h $(BUNDLE) mkdir -p $(dir $@) sed -e s/%VERSION_STR%/$(VERSION)/ \ -e s/%EXEC%/$(EXEC)/ \ -e s@%TARGET%@$(TARGET)@ \ $< > $@ $(BUNDLE)/Contents/PkgInfo : $(BUNDLE) mkdir -p $(dir $@) printf ARPIART5 > $@ clean : rm -fr $(OBJ_OSX) $(BUNDLE) dmg : $(DISTDMG) # create an Apple disk image (dmg) archive of the distribution kit $(DISTDMG) : $(PLUGIN_PARTS) dist/README.html dist/COPYING.txt DIR=`mktemp -d $(EXEC)-XXXX`; \ cp -p dist/README.html dist/COPYING.txt $$DIR; \ cp -Rp $(BUNDLE) $$DIR/"$(EXEC) ($(SHORTTARGET)).aip"; \ hdiutil create -srcfolder $$DIR -ov -volname "$(EXEC) $(VERSION)" $@; \ rm -fr $$DIR @ ls -l $@ # ---------- compile rules ---------- obj/%.o : %.c ; $(CXX) -o $@ -c $< $(CXXFLAGS) $(CPPFLAGS) obj/%.o : %.m ; $(CC) -o $@ -c $< $(CFLAGS) $(CPPFLAGS) obj/main.o : common.h version.h # compile Mac resources (into data fork of .rsrc file) $(PLUGIN_RSRC) : $(BUNDLE) PiPL_macho.r version.r version.h mkdir -p $(dir $@) /Developer/Tools/Rez -o $@ $(filter %.r,$^) -useDF \ $(REZFLAGS) \ -i /Developer/Headers/FlatCarbon # ---------- link rules ---------- # final link step for OS X Mach-O executable $(PLUGIN_OSX) : $(BUNDLE) exports.exp $(OBJ_OSX) mkdir -p $(dir $@) $(CXX) -bundle -o $@ $(OBJ_OSX) $(LDFLAGS) \ -exported_symbols_list exports.exp \ -framework System -framework AppKit ls -l $@ # --------------------