1151497Sru# Copyright (C) 1989-2000, 2002, 2003, 2004 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 18151497Sru# Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. 1918099Spst# 2018099Spst# Makefile.comm 2118099Spst# 2269626SruINCLUDES=-I. -I$(srcdir) \ 2369626Sru -I$(top_builddir)/src/include -I$(top_srcdir)/src/include 2418099SpstALL_CCFLAGS=$(INCLUDES) $(CCDEFINES) $(CCFLAGS) $(CPPFLAGS) 25114402SruCOMPILE.cpp=$(CCC) $(ALL_CCFLAGS) -c 2669626SruALL_CFLAGS=$(INCLUDES) $(CDEFINES) $(CFLAGS) $(CPPFLAGS) 27104862SruCOMPILE.c=$(CC) $(ALL_CFLAGS) -c 28114402SruLINK.cpp=$(CCC) $(CCFLAGS) $(LDFLAGS) 2918099SpstLINK.c=$(CC) $(CFLAGS) $(LDFLAGS) 30114402SruLIBGROFF=$(top_builddir)/src/libs/libgroff/libgroff.$(LIBEXT) 31114402SruLIBBIB=$(top_builddir)/src/libs/libbib/libbib.$(LIBEXT) 32114402SruLIBDRIVER=$(top_builddir)/src/libs/libdriver/libdriver.$(LIBEXT) 33151497SruLIBXUTIL=$(top_builddir)/src/libs/libxutil/libxutil.$(LIBEXT) 3418099SpstMLIB= 3518099SpstXLIBS= 3618099SpstYTABH= 3718099SpstYTABC= 3818099SpstGRAM= 3918099SpstLIBCLEAN= 4018099SpstCLEANADD= 41104862SruCLEANDIRADD= 42104862SruCLEANNOTSRCDIRADD= 4318099SpstMOSTLYCLEANFILES=$(MANCLEAN) $(PROG) $(OBJS) $(GENSRCS) $(GENHDRS) \ 4418099Spst depend.temp core y.output $(CLEANADD) 4518099SpstCLEANFILES=$(LIBCLEAN) 4669626SruDISTCLEANFILES=TAGS Makefile Makefile.dep 4718099SpstREALCLEANFILES=$(YTABC) $(YTABH) 4818099SpstNAMEPREFIX= 4918099SpstHDRS= 5018099SpstMANPAGES=$(MAN1) $(MAN5) $(MAN7) 5118099SpstMANCLEAN=$(MANPAGES) 5218099Spstfontsubdir=$(fontdir)/dev$(DEV) 5318099Spst 5418099Spstall install install_bin install_data TAGS depend distfiles uninstall_sub: 5518099Spst 5669626Sruinstall: prefix_must_exist install_bin install_data 5718099Spstuninstall: uninstall_sub 5818099Spstpure: 5918099Spst 6018099Spst.PHONY: all clean distclean mostlyclean realclean extraclean depend distfiles 6169626Sru.PHONY: install install_bin install_data prefix_must_exist 6218099Spst.PHONY: uninstall uninstall_sub 6318099Spst.PHONY: pure 6418099Spst 6569626Sruprefix_must_exist: 6669626Sru @test -d $(prefix) \ 6769626Sru || (echo ; \ 6869626Sru echo The prefix directory \`$(prefix)\' doesn\'t exist; \ 6969626Sru echo ; \ 7069626Sru exit 1) 7169626Sru 7218099Spstmostlyclean: 7318099Spst -rm -f $(MOSTLYCLEANFILES) 74104862Sru -rm -rf $(CLEANDIRADD) 75104862Sru -@if test `cd $(srcdir); pwd` = `pwd`; then \ 76104862Sru :; \ 77104862Sru else \ 78104862Sru rm -f $(CLEANNOTSRCDIRADD); \ 79104862Sru fi 8018099Spst 81104862Sruclean: mostlyclean 82104862Sru -rm -f $(CLEANFILES) 8318099Spst 84104862Srudistclean: clean 85104862Sru -rm -f $(DISTCLEANFILES) 86104862Sru -@if test `cd $(srcdir); pwd` = `pwd`; then \ 87104862Sru :; \ 88104862Sru else \ 89104862Sru rm -f $(YTABC) $(YTABH); \ 90104862Sru fi 9118099Spst 92104862Srurealclean: distclean 93104862Sru -rm -f $(REALCLEANFILES) 9418099Spst 95104862Sruextraclean: distclean 96151497Sru -rm -f \#* *~ =* core junk grot old temp tmp tem *.new *.old *.orig 9718099Spst 9818099Spst.SUFFIXES: 99114402Sru.SUFFIXES: .o .obj .cpp .c .y .man .n 10018099Spst 101114402Sru.cpp.o: 102151497Sru $(COMPILE.cpp) $(EXTRA_CCFLAGS) $< 10318099Spst 10418099Spst.c.o: 105151497Sru $(COMPILE.c) $(EXTRA_CFLAGS) $< 10618099Spst 107114402Sru.cpp.obj: 108151497Sru $(COMPILE.cpp) $(EXTRA_CCFLAGS) $< 109104862Sru 110104862Sru.c.obj: 111151497Sru $(COMPILE.c) $(EXTRA_CFLAGS) $< 112104862Sru 113114402Sru.y.cpp: 11418099Spst if test -n "$(YTABH)"; then \ 11518099Spst $(YACC) $(YACCFLAGS) -d $<; \ 11618099Spst else \ 11718099Spst $(YACC) $(YACCFLAGS) $<; \ 11818099Spst fi 11969626Sru -test -f y.tab.h && mv y.tab.h y_tab.h 12069626Sru -test -f y.tab.c && mv y.tab.c y_tab.c 121104862Sru mv y_tab.c $(YTABC) 122151497Sru test -z "$(YTABH)" || mv y_tab.h $(YTABH) 123104862Sru 124104862Sru# The next rule is needed for make of Solaris 2.5.1 to override its 125114402Sru# built-in .y.o rule (which takes precedence over the .y.cpp rule above). 126104862Sru.y.o: 12718099Spst if test -n "$(YTABH)"; then \ 128104862Sru $(YACC) $(YACCFLAGS) -d $<; \ 129104862Sru else \ 130104862Sru $(YACC) $(YACCFLAGS) $<; \ 13118099Spst fi 132104862Sru -test -f y.tab.h && mv y.tab.h y_tab.h 133104862Sru -test -f y.tab.c && mv y.tab.c y_tab.c 134104862Sru mv y_tab.c $(YTABC) 135151497Sru test -z "$(YTABH)" || mv y_tab.h $(YTABH) 136151497Sru $(COMPILE.cpp) $(EXTRA_CCFLAGS) $(YTABC) 13718099Spst 13818099Spst.man.n: 13918099Spst @echo Making $@ from $< 14018099Spst @-rm -f $@ 14175584Sru @sed -e "s|@BINDIR@|$(bindir)|g" \ 14275584Sru -e "s|@FONTDIR@|$(fontdir)|g" \ 143104862Sru -e "s|@LOCALFONTDIR@|$(localfontdir)|g" \ 144104862Sru -e "s|@LEGACYFONTDIR@|$(legacyfontdir)|g" \ 14569626Sru -e "s|@MACRODIR@|$(tmacdir)|g" \ 14675584Sru -e "s|@SYSTEMMACRODIR@|$(systemtmacdir)|g" \ 14775584Sru -e "s|@LOCALMACRODIR@|$(localtmacdir)|g" \ 148104862Sru -e "s|@DOCDIR@|$(docdir)|g" \ 149104862Sru -e "s|@EXAMPLEDIR@|$(exampledir)|g" \ 150104862Sru -e "s|@HTMLDOCDIR@|$(htmldocdir)|g" \ 151151497Sru -e "s|@PDFDOCDIR@|$(pdfdocdir)|g" \ 15269626Sru -e "s|@DEVICE@|$(DEVICE)|g" \ 15369626Sru -e "s|@DEFAULT_INDEX@|$(indexdir)/$(indexname)|g" \ 15469626Sru -e "s|@DEFAULT_INDEX_NAME@|$(indexname)|g" \ 15569626Sru -e "s|@INDEX_SUFFIX@|$(indexext)|g" \ 15669626Sru -e "s|@COMMON_WORDS_FILE@|$(common_words_file)|g" \ 15769626Sru -e "s|@MAN1EXT@|$(man1ext)|g" \ 15869626Sru -e "s|@MAN5EXT@|$(man5ext)|g" \ 15969626Sru -e "s|@MAN7EXT@|$(man7ext)|g" \ 16069626Sru -e "s|@TMAC_S_PREFIX@|$(tmac_s_prefix)|g" \ 16169626Sru -e "s|@TMAC_M_PREFIX@|$(tmac_m_prefix)|g" \ 16269626Sru -e "s|@TMAC_AN_PREFIX@|$(tmac_an_prefix)|g" \ 16369626Sru -e "s|@TMAC_MDIR@|$(tmacdir)/mm|g" \ 16469626Sru -e "s|@BROKEN_SPOOLER_FLAGS@|$(BROKEN_SPOOLER_FLAGS)|g" \ 16569626Sru -e "s|@VERSION@|$(version)$(revision)|g" \ 16669626Sru -e "s|@MDATE@|`$(SHELL) $(top_srcdir)/mdate.sh $<`|g" \ 16769626Sru -e "s|@g@|$(g)|g" \ 16869626Sru -e "s!@G@!`echo $(g) | tr [a-z] [A-Z]`!g" \ 16918099Spst $< >$@ 17018099Spst 17118099Spst.PHONY: install_man 17218099Spstinstall_man: 17369626Sru -test -d $(manroot) || $(mkinstalldirs) $(manroot) 17469626Sru -test -d $(man1dir) || $(mkinstalldirs) $(man1dir) 17518099Spst @-pages="$(MAN1)"; \ 17618099Spst for p in $$pages; do \ 17718099Spst prog=`basename $$p .n`; \ 17818099Spst target=$(man1dir)/$(NAMEPREFIX)$$prog.$(man1ext); \ 17918099Spst rm -f $$target; \ 18018099Spst echo $(INSTALL_DATA) $$p $$target; \ 18118099Spst $(INSTALL_DATA) $$p $$target; \ 18218099Spst done 18369626Sru -test -d $(man5dir) || $(mkinstalldirs) $(man5dir) 18418099Spst @-pages="$(MAN5)"; \ 18518099Spst for p in $$pages; do \ 18618099Spst target=$(man5dir)/`basename $$p .n`.$(man5ext); \ 18718099Spst rm -f $$target; \ 18818099Spst echo $(INSTALL_DATA) $$p $$target; \ 18918099Spst $(INSTALL_DATA) $$p $$target; \ 19018099Spst done 19169626Sru -test -d $(man7dir) || $(mkinstalldirs) $(man7dir) 19218099Spst @-pages="$(MAN7)"; \ 19318099Spst for p in $$pages; do \ 19418099Spst target=$(man7dir)/`basename $$p .n`.$(man7ext); \ 19518099Spst rm -f $$target; \ 19618099Spst echo $(INSTALL_DATA) $$p $$target; \ 19718099Spst $(INSTALL_DATA) $$p $$target; \ 19818099Spst done 19918099Spst 20018099Spst.PHONY: uninstall_man 20118099Spstuninstall_man: 20218099Spst @-pages="$(MAN1)"; \ 20318099Spst for p in $$pages; do \ 20418099Spst target=$(man1dir)/$(NAMEPREFIX)`basename $$p .n`.$(man1ext); \ 20518099Spst echo rm -f $$target; \ 20618099Spst rm -f $$target; \ 20718099Spst done 20818099Spst @-pages="$(MAN5)"; \ 20918099Spst for p in $$pages; do \ 21018099Spst target=$(man5dir)/`basename $$p .n`.$(man5ext); \ 21118099Spst echo rm -f $$target; \ 21218099Spst rm -f $$target; \ 21318099Spst done 21418099Spst @-pages="$(MAN7)"; \ 21518099Spst for p in $$pages; do \ 21618099Spst target=$(man7dir)/`basename $$p .n`.$(man7ext); \ 21718099Spst echo rm -f $$target; \ 21818099Spst rm -f $$target; \ 21918099Spst done 22018099Spst 22118099Spst.PHONY: install_prog 22218099Spstinstall_prog: 22369626Sru -test -d $(bindir) || $(mkinstalldirs) $(bindir) 22418099Spst rm -f $(bindir)/$(NAMEPREFIX)$(PROG) 22518099Spst $(INSTALL_PROGRAM) $(PROG) $(bindir)/$(NAMEPREFIX)$(PROG) 22618099Spst 22718099Spst.PHONY: uninstall_prog 22818099Spstuninstall_prog: 22918099Spst -rm -f $(bindir)/$(NAMEPREFIX)$(PROG) 23018099Spst 23118099Spst.PHONY: install_dev 23218099Spstinstall_dev: 23369626Sru -test -d $(datadir) || $(mkinstalldirs) $(datadir) 23475584Sru -test -d $(dataprogramdir) || $(mkinstalldirs) $(dataprogramdir) 23569626Sru -test -d $(datasubdir) || $(mkinstalldirs) $(datasubdir) 23669626Sru -test -d $(fontdir) || $(mkinstalldirs) $(fontdir) 23769626Sru -test -d $(fontsubdir) || $(mkinstalldirs) $(fontsubdir) 23818099Spst -if test -d $(srcdir)/generate; then \ 239151497Sru test -d $(fontsubdir)/generate \ 240151497Sru || $(mkinstalldirs) $(fontsubdir)/generate; \ 24118099Spst fi 242151497Sru -test -z "$(DEVFILES)" \ 243151497Sru || for f in ""$(DEVFILES); do \ 244151497Sru rm -f $(fontsubdir)/$$f; \ 245151497Sru if test -f $$f; then \ 246151497Sru $(INSTALL_DATA) $$f $(fontsubdir)/$$f; \ 247151497Sru else \ 248151497Sru $(INSTALL_DATA) $(srcdir)/$$f $(fontsubdir)/$$f; \ 249151497Sru fi; \ 250151497Sru done 251151497Sru -test -z "$(DEVSCRIPTS)" \ 252151497Sru || for f in ""$(DEVSCRIPTS); do \ 253151497Sru rm -f $(fontsubdir)/$$f; \ 254151497Sru if test -f $$f; then \ 255151497Sru $(INSTALL_SCRIPT) $$f $(fontsubdir)/$$f; \ 256151497Sru else \ 257151497Sru $(INSTALL_SCRIPT) $(srcdir)/$$f $(fontsubdir)/$$f; \ 258151497Sru fi; \ 259151497Sru done 26018099Spst 26118099Spst.PHONY: uninstall_dev 26218099Spstuninstall_dev: 263151497Sru -test -z "$(DEVFILES)$(DEVSCRIPTS)" \ 264151497Sru || for f in ""$(DEVFILES) $(DEVSCRIPTS); do \ 265151497Sru rm -f $(fontsubdir)/$$f; \ 266151497Sru done 267151497Sru -test -d $(fontsubdir)/generate && rmdir $(fontsubdir)/generate 26818099Spst -rmdir $(fontsubdir) 26918099Spst 27018099Spst.PHONY: depend_src 27118099Spstdepend_src: depend.temp 27218099Spst mv depend.temp Makefile.dep 27318099Spst 27418099Spstdepend.temp: FORCE 27518099Spst > depend.temp; 276114402Sru if test -f "$(srcdir)/$(YTABC)"; then \ 277114402Sru ytabc="$(srcdir)/$(YTABC)"; \ 278114402Sru else \ 279114402Sru ytabc="$(YTABC)"; \ 280114402Sru fi; \ 281104862Sru test -z "$(CCSRCS)$(YTABC)" \ 282114402Sru || $(CCC) $(ALL_CCFLAGS) -MM $(CCSRCS) $$ytabc >>depend.temp 28318099Spst test -z "$(CSRCS)" \ 28418099Spst || $(CC) $(ALL_CFLAGS) -MM $(CSRCS) >>depend.temp 285151497Sru test -z "$(YTABH)" \ 286151497Sru || (sed -e 's|$(YTABH)|$(YTABC)|g' depend.temp >depend1.temp; \ 287151497Sru mv depend1.temp depend.temp) 28818099Spst 28918099Spst.PHONY: TAGS_src 29018099SpstTAGS_src: 29118099Spst $(ETAGS) $(ETAGSFLAGS) $(CCSRCS) $(CSRCS) 29218099Spst test -z "$(GRAM)$(HDRS)" \ 29318099Spst || $(ETAGS) $(ETAGSFLAGS) -a $(ETAGSCCFLAG) $(GRAM) $(HDRS) 29418099Spst 295104862Sru# This rule is only considered for the subdir_Makefile target. 29618099SpstMakefile: 29718099Spst -rm -f Makefile 29818099Spst echo srcdir=$(srcdir) >>Makefile 29918099Spst echo VPATH=$(VPATH) >>Makefile 30018099Spst cat $(MAKEFILEPARTS) /dev/null >>Makefile 30118099Spst 30218099SpstFORCE: 30318099Spst 30418099Spst.NOEXPORT: 305