Makefile.comm revision 114402
1# Copyright (C) 1989-2000, 2002 Free Software Foundation, Inc. 2# Written by James Clark (jjc@jclark.com) 3# 4# This file is part of groff. 5# 6# groff is free software; you can redistribute it and/or modify it under 7# the terms of the GNU General Public License as published by the Free 8# Software Foundation; either version 2, or (at your option) any later 9# version. 10# 11# groff is distributed in the hope that it will be useful, but WITHOUT ANY 12# WARRANTY; without even the implied warranty of MERCHANTABILITY or 13# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14# for more details. 15# 16# You should have received a copy of the GNU General Public License along 17# with groff; see the file COPYING. If not, write to the Free Software 18# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19# 20# Makefile.comm 21# 22SHELL=/bin/sh 23INCLUDES=-I. -I$(srcdir) \ 24 -I$(top_builddir)/src/include -I$(top_srcdir)/src/include 25ALL_CCFLAGS=$(INCLUDES) $(CCDEFINES) $(CCFLAGS) $(CPPFLAGS) 26COMPILE.cpp=$(CCC) $(ALL_CCFLAGS) -c 27ALL_CFLAGS=$(INCLUDES) $(CDEFINES) $(CFLAGS) $(CPPFLAGS) 28COMPILE.c=$(CC) $(ALL_CFLAGS) -c 29LINK.cpp=$(CCC) $(CCFLAGS) $(LDFLAGS) 30LINK.c=$(CC) $(CFLAGS) $(LDFLAGS) 31LIBGROFF=$(top_builddir)/src/libs/libgroff/libgroff.$(LIBEXT) 32LIBBIB=$(top_builddir)/src/libs/libbib/libbib.$(LIBEXT) 33LIBDRIVER=$(top_builddir)/src/libs/libdriver/libdriver.$(LIBEXT) 34MLIB= 35XLIBS= 36YTABH= 37YTABC= 38GRAM= 39LIBCLEAN= 40CLEANADD= 41CLEANDIRADD= 42CLEANNOTSRCDIRADD= 43MOSTLYCLEANFILES=$(MANCLEAN) $(PROG) $(OBJS) $(GENSRCS) $(GENHDRS) \ 44 depend.temp core y.output $(CLEANADD) 45CLEANFILES=$(LIBCLEAN) 46DISTCLEANFILES=TAGS Makefile Makefile.dep 47REALCLEANFILES=$(YTABC) $(YTABH) 48NAMEPREFIX= 49HDRS= 50MANPAGES=$(MAN1) $(MAN5) $(MAN7) 51MANCLEAN=$(MANPAGES) 52fontsubdir=$(fontdir)/dev$(DEV) 53 54all install install_bin install_data TAGS depend distfiles uninstall_sub: 55 56install: prefix_must_exist install_bin install_data 57uninstall: uninstall_sub 58pure: 59 60.PHONY: all clean distclean mostlyclean realclean extraclean depend distfiles 61.PHONY: install install_bin install_data prefix_must_exist 62.PHONY: uninstall uninstall_sub 63.PHONY: pure 64 65prefix_must_exist: 66 @test -d $(prefix) \ 67 || (echo ; \ 68 echo The prefix directory \`$(prefix)\' doesn\'t exist; \ 69 echo ; \ 70 exit 1) 71 72mostlyclean: 73 -rm -f $(MOSTLYCLEANFILES) 74 -rm -rf $(CLEANDIRADD) 75 -@if test `cd $(srcdir); pwd` = `pwd`; then \ 76 :; \ 77 else \ 78 rm -f $(CLEANNOTSRCDIRADD); \ 79 fi 80 81clean: mostlyclean 82 -rm -f $(CLEANFILES) 83 84distclean: clean 85 -rm -f $(DISTCLEANFILES) 86 -@if test `cd $(srcdir); pwd` = `pwd`; then \ 87 :; \ 88 else \ 89 rm -f $(YTABC) $(YTABH); \ 90 fi 91 92realclean: distclean 93 -rm -f $(REALCLEANFILES) 94 95extraclean: distclean 96 -rm -f \#* *~ =* core junk grot old temp tmp tem 97 98.SUFFIXES: 99.SUFFIXES: .o .obj .cpp .c .y .man .n 100 101.cpp.o: 102 $(COMPILE.cpp) $< 103 104.c.o: 105 $(COMPILE.c) $< 106 107.cpp.obj: 108 $(COMPILE.cpp) $< 109 110.c.obj: 111 $(COMPILE.c) $< 112 113.y.cpp: 114 if test -n "$(YTABH)"; then \ 115 $(YACC) $(YACCFLAGS) -d $<; \ 116 else \ 117 $(YACC) $(YACCFLAGS) $<; \ 118 fi 119 -test -f y.tab.h && mv y.tab.h y_tab.h 120 -test -f y.tab.c && mv y.tab.c y_tab.c 121 mv y_tab.c $(YTABC) 122 if test -n "$(YTABH)"; then mv y_tab.h $(YTABH); fi 123 124# The next rule is needed for make of Solaris 2.5.1 to override its 125# built-in .y.o rule (which takes precedence over the .y.cpp rule above). 126.y.o: 127 if test -n "$(YTABH)"; then \ 128 $(YACC) $(YACCFLAGS) -d $<; \ 129 else \ 130 $(YACC) $(YACCFLAGS) $<; \ 131 fi 132 -test -f y.tab.h && mv y.tab.h y_tab.h 133 -test -f y.tab.c && mv y.tab.c y_tab.c 134 mv y_tab.c $(YTABC) 135 if test -n "$(YTABH)"; then mv y_tab.h $(YTABH); fi 136 $(COMPILE.cpp) $(YTABC) 137 138.man.n: 139 @echo Making $@ from $< 140 @-rm -f $@ 141 @sed -e "s|@BINDIR@|$(bindir)|g" \ 142 -e "s|@FONTDIR@|$(fontdir)|g" \ 143 -e "s|@LOCALFONTDIR@|$(localfontdir)|g" \ 144 -e "s|@LEGACYFONTDIR@|$(legacyfontdir)|g" \ 145 -e "s|@MACRODIR@|$(tmacdir)|g" \ 146 -e "s|@SYSTEMMACRODIR@|$(systemtmacdir)|g" \ 147 -e "s|@LOCALMACRODIR@|$(localtmacdir)|g" \ 148 -e "s|@DOCDIR@|$(docdir)|g" \ 149 -e "s|@EXAMPLEDIR@|$(exampledir)|g" \ 150 -e "s|@HTMLDOCDIR@|$(htmldocdir)|g" \ 151 -e "s|@DEVICE@|$(DEVICE)|g" \ 152 -e "s|@DEFAULT_INDEX@|$(indexdir)/$(indexname)|g" \ 153 -e "s|@DEFAULT_INDEX_NAME@|$(indexname)|g" \ 154 -e "s|@INDEX_SUFFIX@|$(indexext)|g" \ 155 -e "s|@COMMON_WORDS_FILE@|$(common_words_file)|g" \ 156 -e "s|@MAN1EXT@|$(man1ext)|g" \ 157 -e "s|@MAN5EXT@|$(man5ext)|g" \ 158 -e "s|@MAN7EXT@|$(man7ext)|g" \ 159 -e "s|@TMAC_S_PREFIX@|$(tmac_s_prefix)|g" \ 160 -e "s|@TMAC_M_PREFIX@|$(tmac_m_prefix)|g" \ 161 -e "s|@TMAC_AN_PREFIX@|$(tmac_an_prefix)|g" \ 162 -e "s|@TMAC_MDIR@|$(tmacdir)/mm|g" \ 163 -e "s|@BROKEN_SPOOLER_FLAGS@|$(BROKEN_SPOOLER_FLAGS)|g" \ 164 -e "s|@VERSION@|$(version)$(revision)|g" \ 165 -e "s|@MDATE@|`$(SHELL) $(top_srcdir)/mdate.sh $<`|g" \ 166 -e "s|@g@|$(g)|g" \ 167 -e "s!@G@!`echo $(g) | tr [a-z] [A-Z]`!g" \ 168 $< >$@ 169 170.PHONY: install_man 171install_man: 172 -test -d $(manroot) || $(mkinstalldirs) $(manroot) 173 -test -d $(man1dir) || $(mkinstalldirs) $(man1dir) 174 @-pages="$(MAN1)"; \ 175 for p in $$pages; do \ 176 prog=`basename $$p .n`; \ 177 target=$(man1dir)/$(NAMEPREFIX)$$prog.$(man1ext); \ 178 rm -f $$target; \ 179 echo $(INSTALL_DATA) $$p $$target; \ 180 $(INSTALL_DATA) $$p $$target; \ 181 done 182 -test -d $(man5dir) || $(mkinstalldirs) $(man5dir) 183 @-pages="$(MAN5)"; \ 184 for p in $$pages; do \ 185 target=$(man5dir)/`basename $$p .n`.$(man5ext); \ 186 rm -f $$target; \ 187 echo $(INSTALL_DATA) $$p $$target; \ 188 $(INSTALL_DATA) $$p $$target; \ 189 done 190 -test -d $(man7dir) || $(mkinstalldirs) $(man7dir) 191 @-pages="$(MAN7)"; \ 192 for p in $$pages; do \ 193 target=$(man7dir)/`basename $$p .n`.$(man7ext); \ 194 rm -f $$target; \ 195 echo $(INSTALL_DATA) $$p $$target; \ 196 $(INSTALL_DATA) $$p $$target; \ 197 done 198 199.PHONY: uninstall_man 200uninstall_man: 201 @-pages="$(MAN1)"; \ 202 for p in $$pages; do \ 203 target=$(man1dir)/$(NAMEPREFIX)`basename $$p .n`.$(man1ext); \ 204 echo rm -f $$target; \ 205 rm -f $$target; \ 206 done 207 @-pages="$(MAN5)"; \ 208 for p in $$pages; do \ 209 target=$(man5dir)/`basename $$p .n`.$(man5ext); \ 210 echo rm -f $$target; \ 211 rm -f $$target; \ 212 done 213 @-pages="$(MAN7)"; \ 214 for p in $$pages; do \ 215 target=$(man7dir)/`basename $$p .n`.$(man7ext); \ 216 echo rm -f $$target; \ 217 rm -f $$target; \ 218 done 219 220.PHONY: install_prog 221install_prog: 222 -test -d $(bindir) || $(mkinstalldirs) $(bindir) 223 rm -f $(bindir)/$(NAMEPREFIX)$(PROG) 224 $(INSTALL_PROGRAM) $(PROG) $(bindir)/$(NAMEPREFIX)$(PROG) 225 226.PHONY: uninstall_prog 227uninstall_prog: 228 -rm -f $(bindir)/$(NAMEPREFIX)$(PROG) 229 230.PHONY: install_dev 231install_dev: 232 -test -d $(datadir) || $(mkinstalldirs) $(datadir) 233 -test -d $(dataprogramdir) || $(mkinstalldirs) $(dataprogramdir) 234 -test -d $(datasubdir) || $(mkinstalldirs) $(datasubdir) 235 -test -d $(fontdir) || $(mkinstalldirs) $(fontdir) 236 -test -d $(fontsubdir) || $(mkinstalldirs) $(fontsubdir) 237 -if test -d $(srcdir)/generate; then \ 238 test -d $(fontsubdir)/generate || \ 239 $(mkinstalldirs) $(fontsubdir)/generate; \ 240 fi 241 -for f in $(DEVFILES); do \ 242 rm -f $(fontsubdir)/$$f; \ 243 if test -f $$f; then \ 244 $(INSTALL_DATA) $$f $(fontsubdir)/$$f; \ 245 else \ 246 $(INSTALL_DATA) $(srcdir)/$$f $(fontsubdir)/$$f; \ 247 fi; \ 248 done 249 -for f in $(DEVSCRIPTS); do \ 250 rm -f $(fontsubdir)/$$f; \ 251 if test -f $$f; then \ 252 $(INSTALL_SCRIPT) $$f $(fontsubdir)/$$f; \ 253 else \ 254 $(INSTALL_SCRIPT) $(srcdir)/$$f $(fontsubdir)/$$f; \ 255 fi; \ 256 done 257 258.PHONY: uninstall_dev 259uninstall_dev: 260 -for f in $(DEVFILES) $(DEVSCRIPTS); do rm -f $(fontsubdir)/$$f; done 261 -if test -d $(fontsubdir)/generate; then \ 262 rmdir $(fontsubdir)/generate; \ 263 fi 264 -rmdir $(fontsubdir) 265 266.PHONY: depend_src 267depend_src: depend.temp 268 mv depend.temp Makefile.dep 269 270depend.temp: FORCE 271 > depend.temp; 272 if test -f "$(srcdir)/$(YTABC)"; then \ 273 ytabc="$(srcdir)/$(YTABC)"; \ 274 else \ 275 ytabc="$(YTABC)"; \ 276 fi; \ 277 test -z "$(CCSRCS)$(YTABC)" \ 278 || $(CCC) $(ALL_CCFLAGS) -MM $(CCSRCS) $$ytabc >>depend.temp 279 test -z "$(CSRCS)" \ 280 || $(CC) $(ALL_CFLAGS) -MM $(CSRCS) >>depend.temp 281 if test -n "$(YTABH)"; then \ 282 sed -e 's|$(YTABH)|$(YTABC)|g' depend.temp >depend1.temp; \ 283 mv depend1.temp depend.temp; \ 284 fi 285 286.PHONY: TAGS_src 287TAGS_src: 288 $(ETAGS) $(ETAGSFLAGS) $(CCSRCS) $(CSRCS) 289 test -z "$(GRAM)$(HDRS)" \ 290 || $(ETAGS) $(ETAGSFLAGS) -a $(ETAGSCCFLAG) $(GRAM) $(HDRS) 291 292# This rule is only considered for the subdir_Makefile target. 293Makefile: 294 -rm -f Makefile 295 echo srcdir=$(srcdir) >>Makefile 296 echo VPATH=$(VPATH) >>Makefile 297 cat $(MAKEFILEPARTS) /dev/null >>Makefile 298 299FORCE: 300 301.NOEXPORT: 302