Makefile.comm revision 75584
169626Sru# Copyright (C) 1989-2000 Free Software Foundation, Inc.
218099Spst#      Written by James Clark (jjc@jclark.com)
318099Spst# 
418099Spst# This file is part of groff.
518099Spst# 
618099Spst# groff is free software; you can redistribute it and/or modify it under
718099Spst# the terms of the GNU General Public License as published by the Free
818099Spst# Software Foundation; either version 2, or (at your option) any later
918099Spst# version.
1018099Spst# 
1118099Spst# groff is distributed in the hope that it will be useful, but WITHOUT ANY
1218099Spst# WARRANTY; without even the implied warranty of MERCHANTABILITY or
1318099Spst# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1418099Spst# for more details.
1518099Spst# 
1618099Spst# You should have received a copy of the GNU General Public License along
1718099Spst# with groff; see the file COPYING.  If not, write to the Free Software
1818099Spst# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1918099Spst#
2018099Spst# Makefile.comm
2118099Spst#
2218099SpstSHELL=/bin/sh
2369626SruINCLUDES=-I. -I$(srcdir) \
2469626Sru  -I$(top_builddir)/src/include -I$(top_srcdir)/src/include
2518099SpstALL_CCFLAGS=$(INCLUDES) $(CCDEFINES) $(CCFLAGS) $(CPPFLAGS)
2618099SpstCOMPILE.cc=$(CCC) $(ALL_CCFLAGS) -c
2769626SruALL_CFLAGS=$(INCLUDES) $(CDEFINES) $(CFLAGS) $(CPPFLAGS)
2818099SpstCOMPILE.c=$(CC) $(ALL_CFLAGS)  -c
2918099SpstLINK.cc=$(CCC) $(CCFLAGS) $(LDFLAGS)
3018099SpstLINK.c=$(CC) $(CFLAGS) $(LDFLAGS)
3169626SruLIBGROFF=$(top_builddir)/src/libs/libgroff/libgroff.a
3269626SruLIBBIB=$(top_builddir)/src/libs/libbib/libbib.a
3369626SruLIBDRIVER=$(top_builddir)/src/libs/libdriver/libdriver.a
3418099SpstMLIB=
3518099SpstXLIBS=
3618099SpstYTABH=
3718099SpstYTABC=
3818099SpstGRAM=
3918099SpstLIBCLEAN=
4018099SpstCLEANADD=
4118099SpstMOSTLYCLEANFILES=$(MANCLEAN) $(PROG) $(OBJS) $(GENSRCS) $(GENHDRS) \
4218099Spst  depend.temp core y.output $(CLEANADD)
4318099SpstCLEANFILES=$(LIBCLEAN)
4469626SruDISTCLEANFILES=TAGS Makefile Makefile.dep
4518099SpstREALCLEANFILES=$(YTABC) $(YTABH)
4618099SpstNAMEPREFIX=
4718099SpstHDRS=
4818099SpstMANPAGES=$(MAN1) $(MAN5) $(MAN7)
4918099SpstMANCLEAN=$(MANPAGES)
5018099Spstfontsubdir=$(fontdir)/dev$(DEV)
5118099Spst
5218099Spstall install install_bin install_data TAGS depend distfiles uninstall_sub:
5318099Spst
5469626Sruinstall: prefix_must_exist install_bin install_data
5518099Spstuninstall: uninstall_sub
5618099Spstpure:
5718099Spst
5818099Spst.PHONY: all clean distclean mostlyclean realclean extraclean depend distfiles
5969626Sru.PHONY: install install_bin install_data prefix_must_exist
6018099Spst.PHONY: uninstall uninstall_sub
6118099Spst.PHONY: pure
6218099Spst
6369626Sruprefix_must_exist:
6469626Sru	@test -d $(prefix) \
6569626Sru	  || (echo ; \
6669626Sru	      echo The prefix directory \`$(prefix)\' doesn\'t exist; \
6769626Sru	      echo ; \
6869626Sru	      exit 1)
6969626Sru
7018099Spstmostlyclean:
7118099Spst	-rm -f $(MOSTLYCLEANFILES)
7218099Spst
7318099Spstclean:
7418099Spst	-rm -f $(CLEANFILES) $(MOSTLYCLEANFILES)
7518099Spst
7618099Spstdistclean:
7718099Spst	-rm -f $(DISTCLEANFILES) $(CLEANFILES) $(MOSTLYCLEANFILES)
7818099Spst
7918099Spstrealclean:
8018099Spst	-rm -f $(REALCLEANFILES) $(DISTCLEANFILES) $(CLEANFILES) \
8118099Spst	  $(MOSTLYCLEANFILES)
8218099Spst
8318099Spstextraclean:
8418099Spst	-rm -f $(DISTCLEANFILES) $(CLEANFILES) $(MOSTLYCLEANFILES) \
8518099Spst	  \#* *~ =* core junk grot old temp tmp tem
8618099Spst
8718099Spst.SUFFIXES:
8818099Spst.SUFFIXES: .o .cc .c .y .man .n
8918099Spst
9018099Spst.cc.o:
9118099Spst	$(COMPILE.cc) $<
9218099Spst
9318099Spst.c.o:
9418099Spst	$(COMPILE.c) $<
9518099Spst
9618099Spst.y.cc:
9718099Spst	if test -n "$(YTABH)"; then \
9818099Spst	  $(YACC) $(YACCFLAGS) -d $<; \
9918099Spst	else \
10018099Spst	  $(YACC) $(YACCFLAGS) $<; \
10118099Spst	fi
10269626Sru	-test -f y.tab.h && mv y.tab.h y_tab.h
10369626Sru	-test -f y.tab.c && mv y.tab.c y_tab.c
10469626Sru	mv y_tab.c $@
10518099Spst# Avoid ending up with two versions of $(YTABH).
10618099Spst	if test -n "$(YTABH)"; then \
10718099Spst	  if test -f $(srcdir)/$(YTABH); then \
10818099Spst	    rm -f $(YTABH); \
10969626Sru	    mv y_tab.h $(srcdir)/$(YTABH); \
11018099Spst	  else \
11169626Sru	    mv y_tab.h $(YTABH); \
11218099Spst	  fi; \
11318099Spst	fi
11418099Spst
11569626Sruversion=`cat $(top_srcdir)/VERSION`
11669626Sru# No additional number for the groff archive if revision is zero
11769626Srurevision=`sed -e 's/^0$$//' -e 's/^[1-9].*$$/.&/' $(top_srcdir)/REVISION`
11869626Sru
11918099Spst.man.n:
12018099Spst	@echo Making $@ from $<
12118099Spst	@-rm -f $@
12275584Sru	@sed -e "s|@BINDIR@|$(bindir)|g" \
12375584Sru	-e "s|@FONTDIR@|$(fontdir)|g" \
12469626Sru	-e "s|@FONTPATH@|$(fontpath)|g" \
12569626Sru	-e "s|@MACRODIR@|$(tmacdir)|g" \
12675584Sru	-e "s|@SYSTEMMACRODIR@|$(systemtmacdir)|g" \
12775584Sru	-e "s|@LOCALMACRODIR@|$(localtmacdir)|g" \
12869626Sru	-e "s|@MACROPATH@|$(tmacpath)|g" \
12969626Sru	-e "s|@DEVICE@|$(DEVICE)|g" \
13069626Sru	-e "s|@DEFAULT_INDEX@|$(indexdir)/$(indexname)|g" \
13169626Sru	-e "s|@DEFAULT_INDEX_NAME@|$(indexname)|g" \
13269626Sru	-e "s|@INDEX_SUFFIX@|$(indexext)|g" \
13369626Sru	-e "s|@COMMON_WORDS_FILE@|$(common_words_file)|g" \
13469626Sru	-e "s|@MAN1EXT@|$(man1ext)|g" \
13569626Sru	-e "s|@MAN5EXT@|$(man5ext)|g" \
13669626Sru	-e "s|@MAN7EXT@|$(man7ext)|g" \
13769626Sru	-e "s|@TMAC_S_PREFIX@|$(tmac_s_prefix)|g" \
13869626Sru	-e "s|@TMAC_M_PREFIX@|$(tmac_m_prefix)|g" \
13969626Sru	-e "s|@TMAC_AN_PREFIX@|$(tmac_an_prefix)|g" \
14069626Sru	-e "s|@TMAC_MDIR@|$(tmacdir)/mm|g" \
14169626Sru	-e "s|@BROKEN_SPOOLER_FLAGS@|$(BROKEN_SPOOLER_FLAGS)|g" \
14269626Sru	-e "s|@VERSION@|$(version)$(revision)|g" \
14369626Sru	-e "s|@MDATE@|`$(SHELL) $(top_srcdir)/mdate.sh $<`|g" \
14469626Sru	-e "s|@g@|$(g)|g" \
14569626Sru	-e "s!@G@!`echo $(g) | tr [a-z] [A-Z]`!g" \
14618099Spst	$< >$@
14718099Spst
14818099Spst.PHONY: install_man
14918099Spstinstall_man:
15069626Sru	-test -d $(manroot) || $(mkinstalldirs) $(manroot)
15169626Sru	-test -d $(man1dir) || $(mkinstalldirs) $(man1dir)
15218099Spst	@-pages="$(MAN1)"; \
15318099Spst	for p in $$pages; do \
15418099Spst	 prog=`basename $$p .n`; \
15518099Spst	 target=$(man1dir)/$(NAMEPREFIX)$$prog.$(man1ext); \
15618099Spst	 rm -f $$target; \
15718099Spst	 echo $(INSTALL_DATA) $$p $$target; \
15818099Spst	 $(INSTALL_DATA) $$p $$target; \
15918099Spst	done
16069626Sru	-test -d $(man5dir) || $(mkinstalldirs) $(man5dir)
16118099Spst	@-pages="$(MAN5)"; \
16218099Spst	for p in $$pages; do \
16318099Spst	 target=$(man5dir)/`basename $$p .n`.$(man5ext); \
16418099Spst	 rm -f $$target; \
16518099Spst	 echo $(INSTALL_DATA) $$p $$target; \
16618099Spst	 $(INSTALL_DATA) $$p $$target; \
16718099Spst	done
16869626Sru	-test -d $(man7dir) || $(mkinstalldirs) $(man7dir)
16918099Spst	@-pages="$(MAN7)"; \
17018099Spst	for p in $$pages; do \
17118099Spst	 target=$(man7dir)/`basename $$p .n`.$(man7ext); \
17218099Spst	 rm -f $$target; \
17318099Spst	 echo $(INSTALL_DATA) $$p $$target; \
17418099Spst	 $(INSTALL_DATA) $$p $$target; \
17518099Spst	done
17618099Spst
17718099Spst.PHONY: uninstall_man
17818099Spstuninstall_man:
17918099Spst	@-pages="$(MAN1)"; \
18018099Spst	for p in $$pages; do \
18118099Spst	 target=$(man1dir)/$(NAMEPREFIX)`basename $$p .n`.$(man1ext); \
18218099Spst	 echo rm -f $$target; \
18318099Spst	 rm -f $$target; \
18418099Spst	done
18518099Spst	@-pages="$(MAN5)"; \
18618099Spst	for p in $$pages; do \
18718099Spst	 target=$(man5dir)/`basename $$p .n`.$(man5ext); \
18818099Spst	 echo rm -f $$target; \
18918099Spst	 rm -f $$target; \
19018099Spst	done
19118099Spst	@-pages="$(MAN7)"; \
19218099Spst	for p in $$pages; do \
19318099Spst	 target=$(man7dir)/`basename $$p .n`.$(man7ext); \
19418099Spst	 echo rm -f $$target; \
19518099Spst	 rm -f $$target; \
19618099Spst	done
19718099Spst
19818099Spst.PHONY: install_prog
19918099Spstinstall_prog:
20069626Sru	-test -d $(bindir) || $(mkinstalldirs) $(bindir)
20118099Spst	rm -f $(bindir)/$(NAMEPREFIX)$(PROG)
20218099Spst	$(INSTALL_PROGRAM) $(PROG) $(bindir)/$(NAMEPREFIX)$(PROG)
20318099Spst
20418099Spst.PHONY: uninstall_prog
20518099Spstuninstall_prog:
20618099Spst	-rm -f $(bindir)/$(NAMEPREFIX)$(PROG)	
20718099Spst
20818099Spst.PHONY: install_dev
20918099Spstinstall_dev:
21069626Sru	-test -d $(datadir) || $(mkinstalldirs) $(datadir)
21175584Sru	-test -d $(dataprogramdir) || $(mkinstalldirs) $(dataprogramdir)
21269626Sru	-test -d $(datasubdir) || $(mkinstalldirs) $(datasubdir)
21369626Sru	-test -d $(fontdir) || $(mkinstalldirs) $(fontdir)
21469626Sru	-test -d $(fontsubdir) || $(mkinstalldirs) $(fontsubdir)
21518099Spst	-if test -d $(srcdir)/generate; then \
21669626Sru	  test -d $(fontsubdir)/generate || \
21769626Sru	    $(mkinstalldirs) $(fontsubdir)/generate; \
21818099Spst	fi
21918099Spst	-for f in $(DEVFILES); do \
22018099Spst	  rm -f $(fontsubdir)/$$f; \
22118099Spst	  if test -f $$f; then \
22218099Spst	    $(INSTALL_DATA) $$f $(fontsubdir)/$$f; \
22318099Spst	  else \
22418099Spst	    $(INSTALL_DATA) $(srcdir)/$$f $(fontsubdir)/$$f; \
22518099Spst	  fi; \
22618099Spst	done
22718099Spst
22818099Spst.PHONY: uninstall_dev
22918099Spstuninstall_dev:
23018099Spst	-for f in $(DEVFILES); do rm -f $(fontsubdir)/$$f; done
23118099Spst	-if test -d $(fontsubdir)/generate; then \
23218099Spst	  rmdir $(fontsubdir)/generate; \
23318099Spst	fi
23418099Spst	-rmdir $(fontsubdir)
23518099Spst
23618099Spst.PHONY: depend_src
23718099Spstdepend_src: depend.temp
23818099Spst	mv depend.temp Makefile.dep
23918099Spst
24018099Spstdepend.temp: FORCE
24118099Spst	> depend.temp;
24218099Spst	test -z "$(CCSRCS)$(YTABC)"  \
24318099Spst	  || $(CCC) $(ALL_CCFLAGS) -MM $(CCSRCS) $(YTABC) >>depend.temp
24418099Spst	test -z "$(CSRCS)" \
24518099Spst	  || $(CC) $(ALL_CFLAGS) -MM $(CSRCS) >>depend.temp
24618099Spst	if test -n "$(YTABH)"; then \
24769626Sru	  sed -e 's|$(YTABH)|$(YTABC)|g' depend.temp >depend1.temp; \
24869626Sru	  mv depend1.temp depend.temp; \
24918099Spst	fi
25018099Spst
25118099Spst.PHONY: TAGS_src
25218099SpstTAGS_src:
25318099Spst	$(ETAGS) $(ETAGSFLAGS) $(CCSRCS) $(CSRCS)
25418099Spst	test -z "$(GRAM)$(HDRS)" \
25518099Spst	  || $(ETAGS) $(ETAGSFLAGS) -a $(ETAGSCCFLAG) $(GRAM) $(HDRS)
25618099Spst
25718099SpstMakefile:
25818099Spst	-rm -f Makefile
25918099Spst	echo srcdir=$(srcdir) >>Makefile
26018099Spst	echo VPATH=$(VPATH) >>Makefile
26118099Spst	cat $(MAKEFILEPARTS) /dev/null >>Makefile
26218099Spst
26318099SpstFORCE:
26418099Spst
26518099Spst.NOEXPORT:
266