1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
|
# Copyright (C) 2001-2011 Artifex Software, Inc.
# All Rights Reserved.
#
# This software is provided AS-IS with no warranty, either express or
# implied.
#
# This software is distributed under license and may not be copied, modified
# or distributed except as expressly authorized under the terms of that
# license. Refer to licensing information at http://www.artifex.com/
# or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134,
# San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information.
#
# $Id$
# Partial makefile for Unix shared library target
# Useful make commands:
# make so make ghostscript as a shared object
# make sodebug make debug ghostscript as a shared object
# make soinstall install shared object ghostscript
# make soclean remove build files
#
# If you want to test the executable without installing:
# export LD_LIBRARY_PATH=/insert-path-here/sobin
# export GS_LIB=/insert-path-here/lib
# Location for building shared object
SODIRPREFIX=so
SODEBUGDIRPREFIX=sodebug
# ------------------- Ghostscript shared object --------------------------- #
# Shared object names
# simple loader (no support for display device)
GSSOC_XENAME=$(GS)c$(XE)
GSSOC_XE=$(BINDIR)/$(GSSOC_XENAME)
GSSOC=$(BINDIR)/$(GSSOC_XENAME)
# loader suporting display device using Gtk+
GSSOX_XENAME=$(GS)x$(XE)
GSSOX_XE=$(BINDIR)/$(GSSOX_XENAME)
GSSOX=$(BINDIR)/$(GSSOX_XENAME)
# shared library
GS_SONAME_BASE=lib$(GS)
# GNU/Linux
GS_SOEXT=so
GS_SONAME=$(GS_SONAME_BASE).$(GS_SOEXT)
GS_SONAME_MAJOR=$(GS_SONAME).$(GS_VERSION_MAJOR)
GS_SONAME_MAJOR_MINOR=$(GS_SONAME).$(GS_VERSION_MAJOR).$(GS_VERSION_MINOR)
#LDFLAGS_SO=-shared -Wl,-soname=$(GS_SONAME_MAJOR)
# NOTE: the value of LD_SET_DT_SONAME for, for example, Solaris ld, must contain the
# trailing space to separation it from the value of the option. For GNU ld and
# similar linkers it must containt the trailing "="
LDFLAGS_SO=-shared -Wl,$(LD_SET_DT_SONAME)$(LDFLAGS_SO_PREFIX)$(GS_SONAME_MAJOR)
# MacOS X
#GS_SOEXT=dylib
#GS_SONAME=$(GS_SONAME_BASE).$(GS_SOEXT)
#GS_SONAME_MAJOR=$(GS_SONAME_BASE).$(GS_VERSION_MAJOR).$(GS_SOEXT)
#GS_SONAME_MAJOR_MINOR=$(GS_SONAME_BASE).$(GS_VERSION_MAJOR).$(GS_VERSION_MINOR).$(GS_SOEXT)
#LDFLAGS_SO=-dynamiclib -flat_namespace
LDFLAGS_SO_MAC=-dynamiclib -install_name $(GS_SONAME_MAJOR_MINOR)
#LDFLAGS_SO=-dynamiclib -install_name $(FRAMEWORK_NAME)
GS_SO=$(BINDIR)/$(GS_SONAME)
GS_SO_MAJOR=$(BINDIR)/$(GS_SONAME_MAJOR)
GS_SO_MAJOR_MINOR=$(BINDIR)/$(GS_SONAME_MAJOR_MINOR)
# Shared object is built by redefining GS_XE in a recursive make.
# Create symbolic links to the Ghostscript interpreter library
$(GS_SO): $(GS_SO_MAJOR)
$(RM_) $(GS_SO)
ln -s $(GS_SONAME_MAJOR_MINOR) $(GS_SO)
$(GS_SO_MAJOR): $(GS_SO_MAJOR_MINOR)
$(RM_) $(GS_SO_MAJOR)
ln -s $(GS_SONAME_MAJOR_MINOR) $(GS_SO_MAJOR)
# Build the small Ghostscript loaders, with Gtk+ and without
$(GSSOC_XE): $(GS_SO) $(PSSRC)$(SOC_LOADER)
$(GLCC) -g -o $(GSSOC_XE) $(PSSRC)dxmainc.c \
-L$(BINDIR) -l$(GS)
$(GSSOX_XE): $(GS_SO) $(PSSRC)$(SOC_LOADER)
$(GLCC) -g $(SOC_CFLAGS) -o $(GSSOX_XE) $(PSSRC)$(SOC_LOADER) \
-L$(BINDIR) -l$(GS) $(SOC_LIBS)
# ------------------------- Recursive make targets ------------------------- #
SODEFS=\
GS_XE=$(BINDIR)/$(GS_SONAME_MAJOR_MINOR)\
DISPLAY_DEV=$(DD)display.dev\
STDIO_IMPLEMENTATION=c\
BUILDDIRPREFIX=$(BUILDDIRPREFIX)
# This is a bit nasty; because of the directory name rewriting that happens
# on a recursive build, we have to recurse twice before we are sure that
# all the targets are correct.
# Normal shared object
so:
@if test -z "$(MAKE)" -o -z "`$(MAKE) --version 2>&1 | grep GNU`";\
then echo "Warning: this target requires gmake";\
fi
$(MAKE) so-subtarget$(FOR_MAC) BUILDDIRPREFIX=$(SODIRPREFIX)
# Debug shared object
sodebug:
@if test -z "$(MAKE)" -o -z "`$(MAKE) --version 2>&1 | grep GNU`";\
then echo "Warning: this target requires gmake";\
fi
$(MAKE) so-subtarget$(FOR_MAC) GENOPT='-DDEBUG' BUILDDIRPREFIX=$(SODEBUGDIRPREFIX)
so-subtarget:
$(MAKE) $(SODEFS) GENOPT='$(GENOPT)' LDFLAGS='$(LDFLAGS)'\
CFLAGS='$(CFLAGS_STANDARD) $(GCFLAGS) $(AC_CFLAGS) $(XCFLAGS)' prefix=$(prefix)\
directories
$(MAKE) $(SODEFS) GENOPT='$(GENOPT)' LDFLAGS='$(LDFLAGS)'\
CFLAGS='$(CFLAGS_STANDARD) $(GCFLAGS) $(AC_CFLAGS) $(XCFLAGS)' prefix=$(prefix)\
$(AUXDIR)/echogs$(XEAUX) $(AUXDIR)/genarch$(XEAUX)
$(MAKE) $(SODEFS) GENOPT='$(GENOPT)' LDFLAGS='$(LDFLAGS) $(LDFLAGS_SO)'\
CFLAGS='$(CFLAGS_STANDARD) $(CFLAGS_SO) $(GCFLAGS) $(AC_CFLAGS) $(XCFLAGS)'\
prefix=$(prefix)
$(MAKE) $(SODEFS) GENOPT='$(GENOPT)' LDFLAGS='$(LDFLAGS)'\
CFLAGS='$(CFLAGS_STANDARD) $(GCFLAGS) $(AC_CFLAGS) $(XCFLAGS)' prefix=$(prefix)\
$(GSSOC_XE) $(GSSOX_XE)
# special so-subtarget for MAC OS X
so-subtarget_1:
$(MAKE) $(SODEFS) GENOPT='$(GENOPT)' LDFLAGS='$(LDFLAGS)'\
CFLAGS='$(CFLAGS_STANDARD) $(GCFLAGS) $(AC_CFLAGS) $(XCFLAGS)' prefix=$(prefix)\
directories
$(MAKE) $(SODEFS) GENOPT='$(GENOPT)' LDFLAGS='$(LDFLAGS)'\
CFLAGS='$(CFLAGS_STANDARD) $(GCFLAGS) $(AC_CFLAGS) $(XCFLAGS)' prefix=$(prefix)\
$(AUXDIR)/echogs$(XEAUX) $(AUXDIR)/genarch$(XEAUX)
$(MAKE) $(SODEFS) GENOPT='$(GENOPT)' LDFLAGS='$(LDFLAGS) $(LDFLAGS_SO_MAC)'\
CFLAGS='$(CFLAGS_STANDARD) $(CFLAGS_SO) $(GCFLAGS) $(AC_CFLAGS) $(XCFLAGS)'\
prefix=$(prefix)
$(MAKE) $(SODEFS) GENOPT='$(GENOPT)' LDFLAGS='$(LDFLAGS)'\
CFLAGS='$(CFLAGS_STANDARD) $(GCFLAGS) $(AC_CFLAGS) $(XCFLAGS)' prefix=$(prefix)\
$(GSSOC_XE) $(GSSOX_XE)
install-so:
$(MAKE) install-so-subtarget BUILDDIRPREFIX=$(SODIRPREFIX)
install-sodebug:
$(MAKE) install-so-subtarget GENOPT='-DDEBUG' BUILDDIRPREFIX=$(SODEBUGDIRPREFIX)
install-so-subtarget: so-subtarget$(FOR_MAC)
-mkdir -p $(DESTDIR)$(prefix)
-mkdir -p $(DESTDIR)$(datadir)
-mkdir -p $(DESTDIR)$(gsdir)
-mkdir -p $(DESTDIR)$(gsdatadir)
-mkdir -p $(DESTDIR)$(bindir)
-mkdir -p $(DESTDIR)$(libdir)
-mkdir -p $(DESTDIR)$(gsincludedir)
$(INSTALL_PROGRAM) $(GSSOC) $(DESTDIR)$(bindir)/$(GSSOC_XENAME)
$(INSTALL_PROGRAM) $(GSSOX) $(DESTDIR)$(bindir)/$(GSSOX_XENAME)
$(INSTALL_PROGRAM) $(BINDIR)/$(GS_SONAME_MAJOR_MINOR) $(DESTDIR)$(libdir)/$(GS_SONAME_MAJOR_MINOR)
$(RM_) $(DESTDIR)$(libdir)/$(GS_SONAME)
ln -s $(GS_SONAME_MAJOR_MINOR) $(DESTDIR)$(libdir)/$(GS_SONAME)
$(RM_) $(DESTDIR)$(libdir)/$(GS_SONAME_MAJOR)
ln -s $(GS_SONAME_MAJOR_MINOR) $(DESTDIR)$(libdir)/$(GS_SONAME_MAJOR)
$(INSTALL_DATA) $(PSSRC)iapi.h $(DESTDIR)$(gsincludedir)iapi.h
$(INSTALL_DATA) $(PSSRC)ierrors.h $(DESTDIR)$(gsincludedir)ierrors.h
$(INSTALL_DATA) $(GLSRC)gdevdsp.h $(DESTDIR)$(gsincludedir)gdevdsp.h
soinstall:
$(MAKE) soinstall-subtarget BUILDDIRPREFIX=$(SODIRPREFIX)
sodebuginstall:
$(MAKE) soinstall-subtarget GENOPT='-DDEBUG' BUILDDIRPREFIX=$(SODEBUGDIRPREFIX)
soinstall-subtarget: install-so install-scripts install-data $(INSTALL_SHARED) $(INSTALL_CONTRIB)
# Clean targets
soclean:
$(MAKE) BUILDDIRPREFIX=$(SODIRPREFIX) clean-so-subtarget
clean-so-subtarget:
$(MAKE) $(SODEFS) clean-so-subsubtarget
clean-so-subsubtarget: clean
$(RM_) $(BINDIR)/$(GS_SONAME)
$(RM_) $(BINDIR)/$(GS_SONAME_MAJOR)
$(RM_) $(GSSOC)
$(RM_) $(GSSOX)
$(RMN_) -r $(BINDIR) $(GLGENDIR) $(GLOBJDIR) $(PSGENDIR) $(PSOBJDIR)
sodebugclean:
$(MAKE) BUILDDIRPREFIX=$(SODEBUGDIRPREFIX) clean-sodebug-subtarget
clean-sodebug-subtarget:
$(MAKE) $(SODEFS) clean-so-subsubtarget
# End of unix-dll.mak
|