xref: /plan9/sys/src/cmd/gs/src/unix-aux.mak (revision 593dc095aefb2a85c828727bbfa9da139a49bdf4)
1#    Copyright (C) 1999-2004 artofcode LLC. 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: unix-aux.mak,v 1.12 2004/01/22 09:16:30 giles Exp $
17# Partial makefile common to all Unix configurations.
18# This makefile contains the build rules for the auxiliary programs such as
19# echogs, and the 'platform' modules.
20
21# Define the name of this makefile.
22UNIX_AUX_MAK=$(GLSRC)unix-aux.mak
23
24# -------------------------------- Library -------------------------------- #
25
26## The Unix platforms
27
28# We have to include a test for the existence of sys/time.h,
29# because some System V platforms don't have it.
30
31# Unix platforms other than System V, and also System V Release 4
32# (SVR4) platforms.
33unix__=$(GLOBJ)gp_getnv.$(OBJ) $(GLOBJ)gp_unix.$(OBJ) $(GLOBJ)gp_unifs.$(OBJ) $(GLOBJ)gp_unifn.$(OBJ) $(GLOBJ)gp_stdia.$(OBJ) $(GLOBJ)gp_unix_cache.$(OBJ)
34$(GLGEN)unix_.dev: $(unix__) $(GLD)nosync.dev
35	$(SETMOD) $(GLGEN)unix_ $(unix__) -include $(GLD)nosync
36
37$(GLOBJ)gp_unix.$(OBJ): $(GLSRC)gp_unix.c $(AK)\
38 $(pipe__h) $(string__h) $(time__h)\
39 $(gx_h) $(gsexit_h) $(gp_h)
40	$(GLCC) $(GLO_)gp_unix.$(OBJ) $(C_) $(GLSRC)gp_unix.c
41
42$(GLOBJ)gp_unix_cache.$(OBJ): $(GLSRC)gp_unix_cache.c $(AK)\
43 $(stdio__h) $(string__h) $(time__h) $(gconfigd_h) $(gp_h) $(md5_h)
44	$(GLCC) $(GLO_)gp_unix_cache.$(OBJ) $(C_) $(GLSRC)gp_unix_cache.c
45
46# assume all Unix platforms support unbuffered read
47$(GLOBJ)gp_stdia.$(OBJ): $(GLSRC)gp_stdia.c $(AK)\
48  $(stdio__h) $(time__h) $(unistd__h) $(gx_h) $(gp_h)
49	$(GLCC) $(GLO_)gp_stdia.$(OBJ) $(C_) $(GLSRC)gp_stdia.c
50
51# System V platforms other than SVR4, which lack some system calls,
52# but have pipes.
53sysv__=$(GLOBJ)gp_getnv.$(OBJ) $(GLOBJ)gp_unix.$(OBJ) $(GLOBJ)gp_unifs.$(OBJ) $(GLOBJ)gp_unifn.$(OBJ) $(GLOBJ)gp_sysv.$(OBJ)
54$(GLGEN)sysv_.dev: $(sysv__) $(GLD)nosync.dev
55	$(SETMOD) $(GLGEN)sysv_ $(sysv__) -include $(GLD)nosync
56
57$(GLOBJ)gp_sysv.$(OBJ): $(GLSRC)gp_sysv.c $(stdio__h) $(time__h) $(AK)
58	$(GLCC) $(GLO_)gp_sysv.$(OBJ) $(C_) $(GLSRC)gp_sysv.c
59
60# -------------------------- Auxiliary programs --------------------------- #
61
62$(ECHOGS_XE): $(GLSRC)echogs.c $(AK) $(stdpre_h)
63	$(CCAUX) $(I_)$(GLSRCDIR)$(_I) $(O_)$(ECHOGS_XE) $(GLSRC)echogs.c
64
65# On the RS/6000 (at least), compiling genarch.c with gcc with -O
66# produces a buggy executable.
67$(GENARCH_XE): $(GLSRC)genarch.c $(AK) $(GENARCH_DEPS)
68	$(CCAUX) $(I_)$(GLSRCDIR)$(_I) $(O_)$(GENARCH_XE) $(GLSRC)genarch.c
69
70$(GENCONF_XE): $(GLSRC)genconf.c $(AK) $(GENCONF_DEPS)
71	$(CCAUX) $(I_)$(GLSRCDIR)$(_I) $(O_)$(GENCONF_XE) $(GLSRC)genconf.c
72
73$(GENDEV_XE): $(GLSRC)gendev.c $(AK) $(GENDEV_DEPS)
74	$(CCAUX) $(I_)$(GLSRCDIR)$(_I) $(O_)$(GENDEV_XE) $(GLSRC)gendev.c
75
76$(GENHT_XE): $(GLSRC)genht.c $(AK) $(GENHT_DEPS)
77	$(CCAUX) $(GENHT_CFLAGS) $(O_)$(GENHT_XE) $(GLSRC)genht.c
78
79$(GENINIT_XE): $(GLSRC)geninit.c $(AK) $(GENINIT_DEPS)
80	$(CCAUX) $(I_)$(GLSRCDIR)$(_I) $(O_)$(GENINIT_XE) $(GLSRC)geninit.c
81
82# Query the environment to construct gconfig_.h.
83# The "else true;" is required because Ultrix's implementation of sh -e
84# terminates execution of a command if any error occurs, even if the command
85# traps the error with ||.
86INCLUDE=/usr/include
87$(gconfig__h): $(UNIX_AUX_MAK) $(ECHOGS_XE)
88	$(ECHOGS_XE) -w $(gconfig__h) -x 2f2a -s This file was generated automatically by unix-aux.mak. -s -x 2a2f
89	if ( test -f $(INCLUDE)/dirent.h ); then $(ECHOGS_XE) -a $(gconfig__h) -x 23 define HAVE_DIRENT_H; else true; fi
90	if ( test -f $(INCLUDE)/ndir.h ); then $(ECHOGS_XE) -a $(gconfig__h) -x 23 define HAVE_NDIR_H; else true; fi
91	if ( test -f $(INCLUDE)/sys/dir.h ); then $(ECHOGS_XE) -a $(gconfig__h) -x 23 define HAVE_SYS_DIR_H; else true; fi
92	if ( test -f $(INCLUDE)/sys/ndir.h ); then $(ECHOGS_XE) -a $(gconfig__h) -x 23 define HAVE_SYS_NDIR_H; else true; fi
93	if ( test -f $(INCLUDE)/sys/time.h ); then $(ECHOGS_XE) -a $(gconfig__h) -x 23 define HAVE_SYS_TIME_H; else true; fi
94	if ( test -f $(INCLUDE)/sys/times.h ); then $(ECHOGS_XE) -a $(gconfig__h) -x 23 define HAVE_SYS_TIMES_H; else true; fi
95	if ( test -f $(JSRCDIR)/jmemsys.h); then true; else $(ECHOGS_XE) -a $(gconfig__h) -x 23 define DONT_HAVE_JMEMSYS_H; fi
96