1# Makefile  for use with GNU Make
2###########################################################################
3# LPRng - An Extended Print Spooler System
4#
5# Copyright 1988-1995 Patrick Powell, San Diego State University
6#     papowell@sdsu.edu
7# See LICENSE for conditions of use.
8#
9###########################################################################
10# MODULE: TESTSUPPORT/Makefile
11# PURPOSE: install test version of LPD software
12# Makefile.in,v 3.6 1998/03/30 02:15:10 papowell Exp
13########################################################################## 
14#
15# make all - will make the binaries, install them in ${TMP}
16# after this is run, set path to include ${TMP} as first entry
17# try running the tests
18#
19# The HOST is the name of the local host, should be fully-qualified,
20#   otherwise lpd.perms lookups won't work proper ly
21# You can use checkpc -D1 to see what the fully qualified name is.
22#
23# The USER is the name of the local user
24#   Enjoy.
25#
26# Patrick Powell (papowell@sdsu.edu)
27#
28# Mon Jul 10 07:13:35 PDT 1995
29#
30###########################################################################
31#
32
33#************** GENERAL CONFIGURATION INFORMATION ************************
34
35CCOPTFLAGS =  -g # -Wall -O
36
37
38#**************************** SYSTEM DEPENDENCIES **************************
39#
40# These are automatically sedded in by the "configure" script, but you
41# may need to change them if you're on a strange version of UNIX.
42
43# any libs that need to be used to get these programs to compile:
44#
45LIBS=@LIBS@
46# LIBS=-lposix -s       # (on A/UX, if the above doesn't work)
47
48# the compiler optimisation/debugging flags you wish to use.
49#
50# what C compiler to use.
51#
52CC=@CC@
53
54# what C preprocessor to use.
55#
56CPP=@CPP@ $(CCOPTFLAGS)
57
58# how to install stuff.
59#
60INSTALLCMD=@INSTALL@
61
62# a shell interpreter that's as close to the POSIX shell as possible.
63#
64SHELL_PATH=@SHELL@
65SHELL = @SHELL@
66
67#**********************  Helpful definitions *******************************
68SRC=@srcdir@
69@SET_MAKE@
70# CHANGE THESE!!
71#HOST=taco.sdsu.edu
72#USER=papowell
73#
74# Note: the following line is needed when creating binaries in a
75#  different directory than the src directory;  see autoconf(1)
76#  and the configure --src_dir option
77#
78BIN=../src
79
80VPATH=.:..:${SRC}/.
81
82CFLAGS = $(CCOPTFLAGS) @DEFS@ -I. -I ${SRC} -I ..
83
84TMP=/tmp/
85CONFIG_FILE=${TMP}LPD/lpd.conf
86COMMON_CONFIG=${TMP}LPD/common.conf
87PRINTCAP=${TMP}LPD/printcap.${HOST}
88LPD_PRINTCAP=${TMP}LPD/lpd_printcap.${HOST}
89PRINTCAP_DB=${TMP}LPD/printcap.db.${HOST}
90PERMS=${TMP}LPD/lpd.perms.${HOST}
91PERMS_DB=${TMP}LPD/lpd.perms.db.${HOST}
92
93install all: warn files bin perms pc
94	@echo "set the LPD_CONF environment variable to " ${CONFIG_FILE}
95	@echo "and put " ${TMP}LPD " in your path"
96
97
98.PHONY: all warn files bin perms pc ci clean \
99	uninstall realclean mostlyclean distclean \
100	tags info
101
102warn:
103	@echo "HOST is " ${HOST} " and USER is " ${USER}
104	@echo "HOST should be the fully qualified domain name"
105	@echo "USER is the USERID under which the software runs"
106	@if [ ! -n "$${USER}" ] ; then \
107		echo "USER name missing"; \
108		exit 1; \
109	fi;
110	@full=`echo $${HOST} | sed -n '/\./p'`; \
111	if [ ! -n "$$full" ] ; then \
112		echo "HOST name '$$HOST' not fully qualified"; \
113		exit 1 ; \
114	fi;
115
116files:
117	${SRC}/mkinstalldirs ${TMP}LPD
118	cp -r ${SRC}/LPD/* ${TMP}LPD
119	touch ${TMP}t1_lp ${TMP}t5_lp ${TMP}t6_lp
120
121pc: $(CONFIG_FILE) $(COMMON_CONFIG) $(PRINTCAP) $(LPD_PRINTCAP) $(PRINTCAP_DB)
122
123$(CONFIG_FILE): lpd.conf.proto
124	DOMAIN=`echo ${HOST} | sed -e 's/\./ /' -e 's/.* //' `; \
125	sed -e s/_DOMAIN_/$${DOMAIN}/g -e s/_HOST_/${HOST}/g -e "s:_TMP_:${TMP}:g" \
126		 -e s/_USER_/${USER}/ \
127		lpd.conf.proto >${CONFIG_FILE}
128$(COMMON_CONFIG): common.conf.proto
129	sed -e s/_HOST_/${HOST}/ -e 's/^#[0-$(LEVEL)]//' -e "s:_TMP_:${TMP}:g" \
130		common.conf.proto  >$@
131$(PRINTCAP): printcap.proto
132	sed -e s/_HOST_/${HOST}/ -e 's/^#[0-$(LEVEL)]//' -e "s:_TMP_:${TMP}:g" \
133		printcap.proto  >$@
134$(LPD_PRINTCAP): lpd_printcap.proto
135	sed -e s/_HOST_/${HOST}/ -e 's/^#[0-$(LEVEL)]//' -e "s:_TMP_:${TMP}:g" \
136		lpd_printcap.proto  >$@
137$(PRINTCAP_DB): printcap.proto
138	sed -e s/_HOST_/${HOST}/ -e 's/^#[0-$(LEVEL)]//' -e "s:_TMP_:${TMP}:g" \
139		printcap.proto | sh ${SRC}/makedb >$@
140
141perms: $(PERMS) $(PERMS_DB)
142$(PERMS): lpd.perms.proto
143	sed -e s/_HOST_/${HOST}/ -e s/_USER_/${USER}/ lpd.perms.proto >$@
144$(PERMS_DB): lpd.perms.proto
145	sed -e s/_HOST_/${HOST}/ -e s/_USER_/${USER}/ lpd.perms.proto | sh ${SRC}/makedb >$@
146
147
148
149bin: ${TMP}LPD/lpbanner \
150	${TMP}LPD/lpf ${TMP}LPD/lpd ${TMP}LPD/lpc ${TMP}LPD/lpr \
151	${TMP}LPD/lpq ${TMP}LPD/lprm ${TMP}LPD/checkpc \
152	${TMP}LPD/filter ${TMP}LPD/dbserver ${TMP}LPD/clearlog \
153	${TMP}LPD/bqfilter ${TMP}LPD/router
154
155${TMP}LPD/lpbanner: $(BIN)/lpbanner
156	$(INSTALLCMD) -m 755 $(BIN)/lpbanner ${TMP}LPD
157
158${TMP}LPD/lpd: $(BIN)/lpd
159	$(INSTALLCMD) -m 755 $(BIN)/lpd $@
160
161${TMP}LPD/lpc: $(BIN)/lpc
162	$(INSTALLCMD) -m 755 $(BIN)/lpc $@
163
164${TMP}LPD/lpr: $(BIN)/lpr
165	$(INSTALLCMD) -m 755 $(BIN)/lpr $@
166
167${TMP}LPD/lpq: $(BIN)/lpq
168	$(INSTALLCMD) -m 755 $(BIN)/lpq $@
169
170${TMP}LPD/lprm: $(BIN)/lprm
171	$(INSTALLCMD) -m 755 $(BIN)/lprm $@
172
173${TMP}LPD/lpf: $(BIN)/lpf
174	$(INSTALLCMD) -m 755 $(BIN)/lpf $@
175
176${TMP}LPD/checkpc: $(BIN)/checkpc
177	$(INSTALLCMD) -m 755 $(BIN)/checkpc $@
178
179${TMP}LPD/filter: ${SRC}/filter.sh
180	$(INSTALLCMD) -m 755 ${SRC}/filter.sh $@
181
182${TMP}LPD/bqfilter: ${SRC}/bqfilter.sh
183	$(INSTALLCMD) -m 755 ${SRC}/bqfilter.sh $@
184
185${TMP}LPD/router: ${SRC}/router.sh
186	$(INSTALLCMD) -m 755 ${SRC}/router.sh $@
187
188${TMP}LPD/dbserver: ${SRC}/dbserver.sh
189	$(INSTALLCMD) -m 755 ${SRC}/dbserver.sh $@
190
191${TMP}LPD/clearlog: ${SRC}/clearlog
192	$(INSTALLCMD) -m 755 ${SRC}/clearlog $@
193
194CI=
195CO=-kv
196cifast ci:
197	checkin() { \
198		(set +e; rcs -l $$1; exit 0); \
199		ci $(CI) -l -u -f -mUpdate -t-Initial $$1; \
200	}; \
201	for i in *; do \
202		if test -f "$$i" ; then checkin $$i; fi; \
203	done;
204
205clean::
206	-rm -f *.o core *.old
207
208realclean mostlyclean distclean:: clean
209
210UNINSTAll::
211	-rm -rf ${TMP}LPD
212
213TAGS info:
214