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