1 # Copyright (C) 1989-2000 Free Software Foundation, Inc.
2 # Written by James Clark (jjc@jclark.com)
4 # This file is part of groff.
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
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
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.
23 INCLUDES=-I. -I$(srcdir) \
24 -I$(top_builddir)/src/include -I$(top_srcdir)/src/include
25 ALL_CCFLAGS=$(INCLUDES) $(CCDEFINES) $(CCFLAGS) $(CPPFLAGS)
26 COMPILE.cc=$(CCC) $(ALL_CCFLAGS) -c
27 ALL_CFLAGS=$(INCLUDES) $(CDEFINES) $(CFLAGS) $(CPPFLAGS)
28 COMPILE.c=$(CC) $(ALL_CFLAGS) -c
29 LINK.cc=$(CCC) $(CCFLAGS) $(LDFLAGS)
30 LINK.c=$(CC) $(CFLAGS) $(LDFLAGS)
31 LIBGROFF=$(top_builddir)/src/libs/libgroff/libgroff.a
32 LIBBIB=$(top_builddir)/src/libs/libbib/libbib.a
33 LIBDRIVER=$(top_builddir)/src/libs/libdriver/libdriver.a
42 MOSTLYCLEANFILES=$(MANCLEAN) $(PROG) $(OBJS) $(GENSRCS) $(GENHDRS) \
43 depend.temp core y.output $(CLEANADD)
44 CLEANFILES=$(LIBCLEAN)
45 DISTCLEANFILES=TAGS Makefile Makefile.dep
46 REALCLEANFILES=$(YTABC) $(YTABH)
49 MANPAGES=$(MAN1) $(MAN5) $(MAN7)
51 fontsubdir=$(fontdir)/dev$(DEV)
53 all install install_bin install_data TAGS depend distfiles uninstall_sub:
55 install: prefix_must_exist install_bin install_data
56 uninstall: uninstall_sub
59 .PHONY: all clean distclean mostlyclean realclean extraclean depend distfiles
60 .PHONY: install install_bin install_data prefix_must_exist
61 .PHONY: uninstall uninstall_sub
67 echo The prefix directory \`$(prefix)\' doesn\'t exist; \
72 -rm -f $(MOSTLYCLEANFILES)
73 -rm -rf $(CLEANDIRADD)
76 -rm -f $(CLEANFILES) $(MOSTLYCLEANFILES)
79 -rm -f $(DISTCLEANFILES) $(CLEANFILES) $(MOSTLYCLEANFILES)
82 -rm -f $(REALCLEANFILES) $(DISTCLEANFILES) $(CLEANFILES) \
86 -rm -f $(DISTCLEANFILES) $(CLEANFILES) $(MOSTLYCLEANFILES) \
87 \#* *~ =* core junk grot old temp tmp tem
90 .SUFFIXES: .o .cc .c .y .man .n
99 if test -n "$(YTABH)"; then \
100 $(YACC) $(YACCFLAGS) -d $<; \
102 $(YACC) $(YACCFLAGS) $<; \
104 -test -f y.tab.h && mv y.tab.h y_tab.h
105 -test -f y.tab.c && mv y.tab.c y_tab.c
107 # Avoid ending up with two versions of $(YTABH).
108 if test -n "$(YTABH)"; then \
109 if test -f $(srcdir)/$(YTABH); then \
111 mv y_tab.h $(srcdir)/$(YTABH); \
113 mv y_tab.h $(YTABH); \
117 # The next rule is needed for make of Solaris 2.5.1 to override its
118 # built-in .y.o rule (which takes precedence over the .y.cc rule above).
120 if test -n "$(YTABH)"; then \
121 $(YACC) $(YACCFLAGS) -d $<; \
123 $(YACC) $(YACCFLAGS) $<; \
125 -test -f y.tab.h && mv y.tab.h y_tab.h
126 -test -f y.tab.c && mv y.tab.c y_tab.c
128 # Avoid ending up with two versions of $(YTABH).
129 if test -n "$(YTABH)"; then \
130 if test -f $(srcdir)/$(YTABH); then \
132 mv y_tab.h $(srcdir)/$(YTABH); \
134 mv y_tab.h $(YTABH); \
137 $(COMPILE.cc) -o $@ $(YTABC)
139 version=`cat $(top_srcdir)/VERSION`
140 # No additional number for the groff archive if revision is zero
141 revision=`sed -e 's/^0$$//' -e 's/^[1-9].*$$/.&/' $(top_srcdir)/REVISION`
144 @echo Making $@ from $<
146 @sed -e "s|@BINDIR@|$(bindir)|g" \
147 -e "s|@FONTDIR@|$(fontdir)|g" \
148 -e "s|@FONTPATH@|$(fontpath)|g" \
149 -e "s|@MACRODIR@|$(tmacdir)|g" \
150 -e "s|@SYSTEMMACRODIR@|$(systemtmacdir)|g" \
151 -e "s|@LOCALMACRODIR@|$(localtmacdir)|g" \
152 -e "s|@MACROPATH@|$(tmacpath)|g" \
153 -e "s|@DOCDIR@|$(docdir)|g" \
154 -e "s|@EXAMPLEDIR@|$(exampledir)|g" \
155 -e "s|@HTMLDOCDIR@|$(htmldocdir)|g" \
156 -e "s|@DEVICE@|$(DEVICE)|g" \
157 -e "s|@DEFAULT_INDEX@|$(indexdir)/$(indexname)|g" \
158 -e "s|@DEFAULT_INDEX_NAME@|$(indexname)|g" \
159 -e "s|@INDEX_SUFFIX@|$(indexext)|g" \
160 -e "s|@COMMON_WORDS_FILE@|$(common_words_file)|g" \
161 -e "s|@MAN1EXT@|$(man1ext)|g" \
162 -e "s|@MAN5EXT@|$(man5ext)|g" \
163 -e "s|@MAN7EXT@|$(man7ext)|g" \
164 -e "s|@TMAC_S_PREFIX@|$(tmac_s_prefix)|g" \
165 -e "s|@TMAC_M_PREFIX@|$(tmac_m_prefix)|g" \
166 -e "s|@TMAC_AN_PREFIX@|$(tmac_an_prefix)|g" \
167 -e "s|@TMAC_MDIR@|$(tmacdir)/mm|g" \
168 -e "s|@BROKEN_SPOOLER_FLAGS@|$(BROKEN_SPOOLER_FLAGS)|g" \
169 -e "s|@VERSION@|$(version)$(revision)|g" \
170 -e "s|@MDATE@|`$(SHELL) $(top_srcdir)/mdate.sh $<`|g" \
172 -e "s!@G@!`echo $(g) | tr [a-z] [A-Z]`!g" \
177 -test -d $(manroot) || $(mkinstalldirs) $(manroot)
178 -test -d $(man1dir) || $(mkinstalldirs) $(man1dir)
180 for p in $$pages; do \
181 prog=`basename $$p .n`; \
182 target=$(man1dir)/$(NAMEPREFIX)$$prog.$(man1ext); \
184 echo $(INSTALL_DATA) $$p $$target; \
185 $(INSTALL_DATA) $$p $$target; \
187 -test -d $(man5dir) || $(mkinstalldirs) $(man5dir)
189 for p in $$pages; do \
190 target=$(man5dir)/`basename $$p .n`.$(man5ext); \
192 echo $(INSTALL_DATA) $$p $$target; \
193 $(INSTALL_DATA) $$p $$target; \
195 -test -d $(man7dir) || $(mkinstalldirs) $(man7dir)
197 for p in $$pages; do \
198 target=$(man7dir)/`basename $$p .n`.$(man7ext); \
200 echo $(INSTALL_DATA) $$p $$target; \
201 $(INSTALL_DATA) $$p $$target; \
204 .PHONY: uninstall_man
207 for p in $$pages; do \
208 target=$(man1dir)/$(NAMEPREFIX)`basename $$p .n`.$(man1ext); \
209 echo rm -f $$target; \
213 for p in $$pages; do \
214 target=$(man5dir)/`basename $$p .n`.$(man5ext); \
215 echo rm -f $$target; \
219 for p in $$pages; do \
220 target=$(man7dir)/`basename $$p .n`.$(man7ext); \
221 echo rm -f $$target; \
227 -test -d $(bindir) || $(mkinstalldirs) $(bindir)
228 rm -f $(bindir)/$(NAMEPREFIX)$(PROG)
229 $(INSTALL_PROGRAM) $(PROG) $(bindir)/$(NAMEPREFIX)$(PROG)
231 .PHONY: uninstall_prog
233 -rm -f $(bindir)/$(NAMEPREFIX)$(PROG)
237 -test -d $(datadir) || $(mkinstalldirs) $(datadir)
238 -test -d $(dataprogramdir) || $(mkinstalldirs) $(dataprogramdir)
239 -test -d $(datasubdir) || $(mkinstalldirs) $(datasubdir)
240 -test -d $(fontdir) || $(mkinstalldirs) $(fontdir)
241 -test -d $(fontsubdir) || $(mkinstalldirs) $(fontsubdir)
242 -if test -d $(srcdir)/generate; then \
243 test -d $(fontsubdir)/generate || \
244 $(mkinstalldirs) $(fontsubdir)/generate; \
246 -for f in $(DEVFILES); do \
247 rm -f $(fontsubdir)/$$f; \
248 if test -f $$f; then \
249 $(INSTALL_DATA) $$f $(fontsubdir)/$$f; \
251 $(INSTALL_DATA) $(srcdir)/$$f $(fontsubdir)/$$f; \
255 .PHONY: uninstall_dev
257 -for f in $(DEVFILES); do rm -f $(fontsubdir)/$$f; done
258 -if test -d $(fontsubdir)/generate; then \
259 rmdir $(fontsubdir)/generate; \
264 depend_src: depend.temp
265 mv depend.temp Makefile.dep
269 test -z "$(CCSRCS)$(YTABC)" \
270 || $(CCC) $(ALL_CCFLAGS) -MM $(CCSRCS) $(YTABC) >>depend.temp
272 || $(CC) $(ALL_CFLAGS) -MM $(CSRCS) >>depend.temp
273 if test -n "$(YTABH)"; then \
274 sed -e 's|$(YTABH)|$(YTABC)|g' depend.temp >depend1.temp; \
275 mv depend1.temp depend.temp; \
280 $(ETAGS) $(ETAGSFLAGS) $(CCSRCS) $(CSRCS)
281 test -z "$(GRAM)$(HDRS)" \
282 || $(ETAGS) $(ETAGSFLAGS) -a $(ETAGSCCFLAG) $(GRAM) $(HDRS)
284 # This rule is only considered for the subdir_Makefile target.
287 echo srcdir=$(srcdir) >>Makefile
288 echo VPATH=$(VPATH) >>Makefile
289 cat $(MAKEFILEPARTS) /dev/null >>Makefile