1###########################################################################
2# LPRng - An Extended Print Spooler System
3#
4# Copyright 1988-2001 Patrick Powell, San Diego, CA
5#     papowell@lprng.com
6# See LICENSE for conditions of use.
7#
8###########################################################################
9# MODULE: Makefile.in
10# PURPOSE: top level Makefile for LPD Software
11# $Id: Makefile,v 1.1.1.1 2008/10/15 03:28:09 james26_jang Exp $
12########################################################################## 
13
14#**************###########**************
15# You must use ANSI C and GNU Make!
16#***************************************
17
18PACKAGE=LPRng
19VERSION=3.8.22
20SRC=.
21
22INSTALL=/usr/bin/install -c
23
24# prefix
25prefix=/usr/local
26# exec prefix
27exec_prefix=${prefix}
28# for binaries
29bindir=${exec_prefix}/bin
30# for admin type of binaries
31sbindir=${exec_prefix}/sbin
32# for the filters
33libexecdir=${exec_prefix}/libexec
34# for the configuration stuff
35sysconfdir=${prefix}/etc
36# for the man pages
37mandir=${prefix}/man
38# top build directory
39top_builddir=.
40
41LPD_PERMS_PATH=\"${sysconfdir}/lpd/lpd.perms\"
42LPD_CONF_PATH=\"${sysconfdir}/lpd/lpd.conf\"
43PRINTCAP_PATH=\"${sysconfdir}/printcap\"
44LPD_PATH=\"${sbindir}/lpd\"
45#SHELL="/bin/sh"
46LOCKFILE=\"/var/run/lpd\"
47PSHOWALL="-ax"
48FILTER_DIR=${libexecdir}/filters
49LOCALEDIR=${prefix}/share/locale
50INIT=
51USE_NLS=no
52LIBTOOL=$(SHELL) $(top_builddir)/libtool
53
54#=============================================================================
55# List the directories you want to generate:
56# DIRS for all, clean, etc.
57# ALLDIRS for other such as documentation
58#=============================================================================
59
60DIRS= UTILS src po man
61INSTALLDIRS= UTILS src po man
62FILES=./postinstall ./preremove ./postremove ./lpd.conf
63ALLDIRS= ${DIRS} ${SRC}/TESTSUPPORT ${SRC}/DOCS
64ROMFSDIR = $(ROOTDIR)/romfs
65
66###############################################################################
67
68all: ${DIRS} ${FILES}
69
70SCRIPTS=init.freebsd init.linux init.redhat init.linuxsb init.solaris ltmain postinstall.freebsd postinstall.generic postinstall.linux postinstall.solaris postremove.generic postremove.solaris preinstall.solaris preremove.freebsd preremove.generic preremove.linux preremove.solaris
71
72$(SCRIPTS): header
73	cat header ${SRC}/$@.sh >$@
74	chmod 755 $@;
75
76header: Makefile
77	@echo "#!/bin/sh" >$@
78	@echo PREFIX=$(prefix) >>$@
79	@echo LPD_PATH=$(LPD_PATH) >>$@
80	@echo INSTALL=\"$(INSTALL)\" >>$@
81	@echo LPD_PERMS_PATH=$(LPD_PERMS_PATH) >>$@
82	@echo LPD_CONF_PATH=$(LPD_CONF_PATH) >>$@
83	@echo PRINTCAP_PATH=$(PRINTCAP_PATH) >>$@
84	@echo SYSCONFDIR=$(sysconfdir) >>$@
85	@echo SBINDIR=$(sbindir) >>$@
86	@echo FILTER_DIR=$(FILTER_DIR) >>$@
87	@echo LOCKFILE=$(LOCKFILE) >>$@
88	@echo PSHOWALL=\"$(PSHOWALL)\"  >>$@
89	@echo "VERSION=$(VERSION)" >>$@
90	@echo "INIT=$(INIT)" >>$@
91	@echo "MANDIR=$(mandir)" >>$@
92
93./postinstall: $(SCRIPTS) Makefile
94	OSNAME=elf; case "elf" in \
95	 *linux* ) OSNAME=linux;; \
96	 *freebsd* ) OSNAME=freebsd;; \
97	 *solaris* ) OSNAME=solaris;; \
98	esac; \
99	if test -f postinstall.$${OSNAME} ; then s=postinstall.$${OSNAME} ; else s=postinstall.generic; fi; \
100	echo POSTINSTALL "'$$s'"; cp $$s postinstall;
101
102./preremove: $(SCRIPTS) Makefile
103	OSNAME=elf; case "elf" in *linux* ) OSNAME=linux;; esac; \
104	if test -f preremove.$${OSNAME} ; then s=preremove.$${OSNAME} ; else s=preremove.generic; fi; \
105	echo PREREMOVE "'$$s'"; cp $$s preremove;
106
107./postremove: $(SCRIPTS) Makefile
108	OSNAME=elf; case "elf" in *linux* ) OSNAME=linux;; esac; \
109	if test -f postremove.$${OSNAME} ; then s=postremove.$${OSNAME} ; else s=postremove.generic; fi; \
110	echo POSTREMOVE "'$$s'"; cp $$s postremove;
111
112# define default target
113.PHONY: all warn TAGS clean uninstall install  info dvi check \
114	tar send realclean mostlyclean distclean dist update ci cifiles $(ALLDIRS) \
115
116MAKETARGET=all
117
118###############################################################################
119$(ALLDIRS):
120	if [ "$@" != po -o "$(USE_NLS)" != "no" ] ; then \
121		cd $@; $(MAKE) localedir=${LOCALEDIR} \
122			DESTDIR=$(DESTDIR) $(MAKETARGET) ; \
123	fi
124
125TAGS clean::
126	-$(MAKE) MAKETARGET=$@ DESTDIR=$(DESTDIR) $(DIRS)
127
128clean::
129	-rm -f header lpd.conf $(FILES) $(SCRIPTS) postinstall preremove postremove a.out
130	-rm -f *.bak ? ?.* core *.old *~ po/*~
131
132#install: all
133#	$(MAKE) MAKETARGET=$@ DESTDIR=$(DESTDIR) $(INSTALLDIRS)
134#
135#	if [ "${POSTINSTALL}" != "NO" -a "${POSTINSTALL}" != "no" ] ; then \
136#		MAKEINSTALL=YES DESTDIR=$(DESTDIR) $(SHELL) postinstall ; \
137#	fi;
138#	@echo "";
139
140install: all
141	install -D src/lpd $(INSTALLDIR)/usr/sbin/lpd
142	$(STRIP) $(INSTALLDIR)/usr/sbin/lpd
143
144info dvi check:
145
146./lpd.conf: src/lpd.conf
147	cp src/lpd.conf $@
148	chmod 644 $@
149
150src/lpd.conf:
151	cd src; $(MAKE) MAKETARGET=lpd.conf
152
153realclean mostlyclean distclean: clean
154	rm -rf DISTRIBUTIONS/FreeBSD*/work DISTRIBUTIONS/FreeBSD*/*.tgz ;
155	$(MAKE) MAKETARGET=$@ DESTDIR=$(DESTDIR) $(ALLDIRS)
156	rm -f `find . -type f -name '*.old' -print` \
157	 `find . -type f -name '*.bak' -print` \
158	 `find . -type f -name '*.orig' -print` \
159	  configure.lineno config.cache config.log config.status lpd.conf libtool \
160	  Makefile */Makefile po/POTFILES
161	rm -f `find . -type f -name '*.in' -print | sed -e 's/\.in$$//' -e /configure/d `
162
163###############################################################################
164uninstall:
165	echo "you must uninstall by hand"
166
167ci: cifiles
168	for i in $(ALLDIRS); do \
169		case $$i in \
170		po ) ;; \
171		* ) $(MAKE) MAKETARGET=$@ $$i ;; \
172		esac; \
173	done;
174	chmod 755 `find . -name install-sh -print`
175	chmod 755 `find . -name mkinstalldirs -print`
176
177#CI=
178#CO=-kv
179CO=-l
180
181cifiles:
182	for i in . $(ALLDIRS); do \
183		if test ! -d $$i/RCS ; then \
184			mkdir $$i/RCS; \
185		fi; \
186	done;
187	checkin() { \
188		(set +e; rcs -l $$1; exit 0); \
189		ci $(CI) -l -u -f -mUpdate -t-Initial $$1; \
190	}; \
191	for i in * */Makefile po/* ; do \
192		if test -f "$$i" ; then \
193			case "$$i" in  \
194			*.mo ) ;; \
195			config.* ) ;; \
196			configure ) ;; \
197			* ) checkin $$i ;; \
198			esac; \
199		fi; \
200	done;
201
202###############################################################################
203# Update the patch level when you make a new version
204# do this before you start changes
205# Don't even think about making this configurable, it is for
206# distribution and update purposes only!
207#  Patrick Powell
208###############################################################################
209
210update:
211	rm -f src/include/license.h src/include/copyright.h
212	sed -e 's/"/\\"/g' -e 's/.*/"&",/' LICENSE >src/include/license.h
213	sed -e 's/"/\\"/g' -e 's/.*/"&",/' COPYRIGHT >src/include/copyright.h
214	for i in VERSION ./src/include/patchlevel.h configure.in ; do \
215		rcs -l $$i; chmod +w $$i; \
216	done;
217	if [ -x /bin/pwd ] ; then DIR=`/bin/pwd`; fi ; \
218	if [ -x /usr/bin/pwd ] ; then DIR=`/usr/bin/pwd`; fi ; \
219	DIR=`echo $${DIR} | sed 's,.*/,,'`; \
220	DIRVER=` echo $${DIR} | sed 's,.*-,,'`; \
221	echo DIR $${DIR}, DIRVER $${DIRVER}; \
222	echo "#define PATCHLEVEL \"$${DIR}\"" >./src/include/patchlevel.h; \
223	echo $${DIR} >VERSION; \
224	S=`echo *.sh | sed -e 's/\.sh//g'`; \
225	perl -spi -e "s,=.*,=$${DIRVER}, if(/^VERSION=/ or /^#.* VERSION=/); \
226		s,^DISTNAME=.*,DISTNAME=$${DIR},; \
227		s,^PORTNAME=.*,PORTNAME=$(PACKAGE),; \
228		s,^PORTVERSION=.*,PORTVERSION=$${DIRVER},; \
229		s,package name \".*\",package name \"$${DIR}\",; \
230		s,^SCRIPTS=.*,SCRIPTS=$$S,;" \
231		configure.in lpd.perms.in \
232		DISTRIBUTIONS/*/Makefile \
233		po/Makefile.in.in printcap
234	perl -spi -e 's,.*,"Project-Id-Version: $(PACKAGE) $(VERSION)\\n", if(/^"Project-Id/);' \
235		po/*.po
236	sh CREATE_CONFIGURE
237	sh STANDARD_configuration
238#	ci $(CI) -l -f -mUpdate -t-Initial Makefile DOCS/Makefile src/Makefile
239	for i in DOCS man ; do \
240		(cd $$i ; $(MAKE) $@ ); \
241	done;
242	for i in po ; do \
243		(cd $$i ; $(MAKE) update-po ); \
244	done
245
246###############################################################################
247# Make a gnutar distribution
248#   - note that not all the source tree is sent out
249#
250###############################################################################
251
252tar: distclean
253	rm -f */Makefile Makefile
254	chmod 755 `find . -name install-sh -print`
255	chmod 755 `find . -name mkinstalldirs -print`
256	chmod -R +w .
257	if [ -x /bin/pwd ] ; then DIR=`/bin/pwd`; fi ; \
258	if [ -x /usr/bin/pwd ] ; then DIR=`/usr/bin/pwd`; fi ; \
259	echo $${DIR}; \
260	DIR=`echo $${DIR} | sed 's,.*/,,'`; \
261		cd ..; \
262		tar '--exclude=RCS' -zcf $${DIR}.tgz $${DIR}; \
263		md5 $${DIR}.tgz | pgp -fast -u papowell@lprng > $${DIR}.tgz.md5
264	@echo ""
265
266configure: configure.in
267	autoconf
268	autoheader
269
270dist: update ci distclean tar send
271redist: ci distclean tar send
272
273send:
274	if [ -f ../SENDTO ] ; then (cd ..; sh SENDTO) ; fi
275