1# Copyright (C) 2001 Artifex Software, Inc. All rights reserved. 2# 3# This software is provided AS-IS with no warranty, either express or 4# implied. 5# 6# This software is distributed under license and may not be copied, 7# modified or distributed except as expressly authorized under the terms 8# of the license contained in the file LICENSE in this distribution. 9# 10# For more information about licensing, please refer to 11# http://www.ghostscript.com/licensing/. For information on 12# commercial licensing, go to http://www.artifex.com/licensing/ or 13# contact Artifex Software, Inc., 101 Lucas Valley Road #110, 14# San Rafael, CA 94903, U.S.A., +1(415)492-9861. 15 16# $Id: macos-fw.mak,v 1.7 2003/09/03 03:22:59 giles Exp $ 17# Partial makefile for MacOS X/Darwin shared object target 18 19# Useful make commands: 20# make framework make ghostscript as a MacOS X framework 21# make framework_install install the framework 22# make so make ghostscript as a shared object 23# make sodebug make debug ghostscript as a shared object 24# make soinstall install shared object ghostscript 25# make soclean remove build files 26# 27# If you want to test the executable without installing: 28# export LD_LIBRARY_PATH=/insert-path-here/sobin 29# export GS_LIB=/insert-path-here/lib 30 31# Location for building shared object 32SOOBJRELDIR=../soobj 33SOBINRELDIR=../sobin 34 35# ------------------- Ghostscript shared object --------------------------- # 36 37# Shared object names 38 39# simple loader (no support for display device) 40GSSOC_XENAME=$(GS)c$(XE) 41GSSOC_XE=$(BINDIR)/$(GSSOC_XENAME) 42GSSOC=$(BINDIR)/$(SOBINRELDIR)/$(GSSOC_XENAME) 43 44# shared library 45#SOPREF=.so 46#SOSUF= 47SOPREF= 48SOSUF=.dylib 49 50GS_SONAME_BASE=lib$(GS)$(SOPREF) 51GS_SONAME=$(GS_SONAME_BASE)$(SOSUF) 52GS_SONAME_MAJOR=$(GS_SONAME_BASE).$(GS_VERSION_MAJOR)$(SOSUF) 53GS_SONAME_MAJOR_MINOR= $(GS_SONAME_BASE).$(GS_VERSION_MAJOR).$(GS_VERSION_MINOR)$(SOSUF) 54GS_SO=$(BINDIR)/$(GS_SONAME) 55GS_SO_MAJOR=$(BINDIR)/$(GS_SONAME_MAJOR) 56GS_SO_MAJOR_MINOR=$(BINDIR)/$(GS_SONAME_MAJOR_MINOR) 57 58# Shared object is built by redefining GS_XE in a recursive make. 59 60# Create symbolic links to the Ghostscript interpreter library 61 62$(GS_SO): $(GS_SO_MAJOR) 63 $(RM_) $(GS_SO) 64 ln -s $(GS_SONAME_MAJOR_MINOR) $(GS_SO) 65 66$(GS_SO_MAJOR): $(GS_SO_MAJOR_MINOR) 67 $(RM_) $(GS_SO_MAJOR) 68 ln -s $(GS_SONAME_MAJOR_MINOR) $(GS_SO_MAJOR) 69 70# Build the small Ghostscript loaders 71# it would be nice if we could link to the framework instead 72 73$(GSSOC_XE): $(GS_SO) $(GLSRC)dxmainc.c 74 $(GLCC) -g -o $(GSSOC_XE) $(GLSRC)dxmainc.c -L$(BINDIR) -l$(GS) 75 76# ------------------------- Recursive make targets ------------------------- # 77 78# we pass the framework path under -install_name here rather than /usr/local/lib 79# or whatever. This will effectively break the .dylib build in favor of the 80# Framework. Generally on MacOS X this is what we want, but there should be 81# a separate .dylib target if we're going to build them at all 82# we should also be passing compatibility versions 83 84SODEFS=LDFLAGS='$(LDFLAGS) $(CFLAGS_SO) -dynamiclib -install_name $(prefix)/$(FRAMEWORK_NAME)'\ 85 GS_XE=$(BINDIR)/$(SOBINRELDIR)/$(GS_SONAME_MAJOR_MINOR)\ 86 STDIO_IMPLEMENTATION=c\ 87 DISPLAY_DEV=$(DD)$(SOOBJRELDIR)/display.dev\ 88 BINDIR=$(BINDIR)/$(SOBINRELDIR)\ 89 GLGENDIR=$(GLGENDIR)/$(SOOBJRELDIR)\ 90 GLOBJDIR=$(GLOBJDIR)/$(SOOBJRELDIR)\ 91 PSGENDIR=$(PSGENDIR)/$(SOOBJRELDIR)\ 92 PSOBJDIR=$(PSOBJDIR)/$(SOOBJRELDIR) 93 94 95# Normal shared object 96so: SODIRS 97 $(MAKE) $(SODEFS) CFLAGS='$(CFLAGS_STANDARD) $(CFLAGS_SO) $(GCFLAGS) $(XCFLAGS)' prefix=$(prefix) $(GSSOC) $(GSSOX) 98 99# Debug shared object 100# Note that this is in the same directory as the normal shared 101# object, so you will need to use 'make soclean', 'make sodebug' 102sodebug: SODIRS 103 $(MAKE) $(SODEFS) GENOPT='-DDEBUG' CFLAGS='$(CFLAGS_DEBUG) $(CFLAGS_SO) $(GCFLAGS) $(XCFLAGS)' $(GSSOC) $(GSSOX) 104 105install-so: so 106 -mkdir $(prefix) 107 -mkdir $(datadir) 108 -mkdir $(gsdir) 109 -mkdir $(gsdatadir) 110 -mkdir $(bindir) 111 -mkdir $(libdir) 112 $(INSTALL_PROGRAM) $(GSSOC) $(bindir)/$(GSSOC_XENAME) 113 $(INSTALL_PROGRAM) $(GSSOX) $(bindir)/$(GSSOX_XENAME) 114 $(INSTALL_PROGRAM) $(BINDIR)/$(SOBINRELDIR)/$(GS_SONAME_MAJOR_MINOR) $(libdir)/$(GS_SONAME_MAJOR_MINOR) 115 $(RM_) $(libdir)/$(GS_SONAME) 116 ln -s $(GS_SONAME_MAJOR_MINOR) $(libdir)/$(GS_SONAME) 117 $(RM_) $(libdir)/$(GS_SONAME_MAJOR) 118 ln -s $(GS_SONAME_MAJOR_MINOR) $(libdir)/$(GS_SONAME_MAJOR) 119 120soinstall: install-so install-scripts install-data 121 122GS_FRAMEWORK=$(BINDIR)/$(SOBINRELDIR)/$(FRAMEWORK_NAME)$(FRAMEWORK_EXT) 123 124framework: so lib/Info-macos.plist 125 rm -rf $(GS_FRAMEWORK) 126 -mkdir $(GS_FRAMEWORK) 127 -mkdir $(GS_FRAMEWORK)/Versions 128 -mkdir $(GS_FRAMEWORK)/Versions/$(GS_DOT_VERSION) 129 -mkdir $(GS_FRAMEWORK)/Versions/$(GS_DOT_VERSION)/Headers 130 -mkdir $(GS_FRAMEWORK)/Versions/$(GS_DOT_VERSION)/Resources 131 (cd $(GS_FRAMEWORK)/Versions; ln -s $(GS_DOT_VERSION) Current) 132 (cd $(GS_FRAMEWORK); \ 133 ln -s Versions/Current/Headers . ;\ 134 ln -s Versions/Current/Resources ;\ 135 ln -s Versions/Current/man . ;\ 136 ln -s Versions/Current/doc . ;\ 137 ln -s Versions/Current/$(FRAMEWORK_NAME) . ) 138 pwd 139 cp src/iapi.h src/ierrors.h src/gdevdsp.h $(GS_FRAMEWORK)/Headers/ 140 cp lib/Info-macos.plist $(GS_FRAMEWORK)/Resources/ 141 cp -r lib $(GS_FRAMEWORK)/Resources/ 142 cp $(BINDIR)/$(SOBINRELDIR)/$(GS_SONAME_MAJOR_MINOR) $(GS_FRAMEWORK)/Versions/Current/$(FRAMEWORK_NAME) 143 cp -r man $(GS_FRAMEWORK)/Versions/Current 144 cp -r doc $(GS_FRAMEWORK)/Versions/Current 145 146framework_install : framework 147 rm -rf $(prefix) 148 cp -r $(GS_FRAMEWORK) $(prefix) 149 150# Make the build directories 151SODIRS: STDDIRS 152 @if test ! -d $(BINDIR)/$(SOBINRELDIR); then mkdir $(BINDIR)/$(SOBINRELDIR); fi 153 @if test ! -d $(GLGENDIR)/$(SOOBJRELDIR); then mkdir $(GLGENDIR)/$(SOOBJRELDIR); fi 154 @if test ! -d $(GLOBJDIR)/$(SOOBJRELDIR); then mkdir $(GLOBJDIR)/$(SOOBJRELDIR); fi 155 @if test ! -d $(PSGENDIR)/$(SOOBJRELDIR); then mkdir $(PSGENDIR)/$(SOOBJRELDIR); fi 156 @if test ! -d $(PSOBJDIR)/$(SOOBJRELDIR); then mkdir $(PSOBJDIR)/$(SOOBJRELDIR); fi 157 158 159soclean: SODIRS 160 $(MAKE) $(SODEFS) clean 161 $(RM_) $(BINDIR)/$(SOBINRELDIR)/$(GS_SONAME) 162 $(RM_) $(BINDIR)/$(SOBINRELDIR)/$(GS_SONAME_MAJOR) 163 $(RM_) $(GSSOC) 164 $(RM_) $(GSSOX) 165 166# End of unix-dll.mak 167