1 # Copyright (C) 1989-2000, 2002, 2003, 2004 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, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA.
22 INCLUDES=-I. -I$(srcdir) \
23 -I$(top_builddir)/src/include -I$(top_srcdir)/src/include
24 ALL_CCFLAGS=$(INCLUDES) $(CCDEFINES) $(CCFLAGS) $(CPPFLAGS)
25 COMPILE.cpp=$(CCC) $(ALL_CCFLAGS) -c
26 ALL_CFLAGS=$(INCLUDES) $(CDEFINES) $(CFLAGS) $(CPPFLAGS)
27 COMPILE.c=$(CC) $(ALL_CFLAGS) -c
28 LINK.cpp=$(CCC) $(CCFLAGS) $(LDFLAGS)
29 LINK.c=$(CC) $(CFLAGS) $(LDFLAGS)
30 LIBGROFF=$(top_builddir)/src/libs/libgroff/libgroff.$(LIBEXT)
31 LIBBIB=$(top_builddir)/src/libs/libbib/libbib.$(LIBEXT)
32 LIBDRIVER=$(top_builddir)/src/libs/libdriver/libdriver.$(LIBEXT)
33 LIBXUTIL=$(top_builddir)/src/libs/libxutil/libxutil.$(LIBEXT)
43 MOSTLYCLEANFILES=$(MANCLEAN) $(PROG) $(OBJS) $(GENSRCS) $(GENHDRS) \
44 depend.temp core y.output $(CLEANADD)
45 CLEANFILES=$(LIBCLEAN)
46 DISTCLEANFILES=TAGS Makefile Makefile.dep
47 REALCLEANFILES=$(YTABC) $(YTABH)
50 MANPAGES=$(MAN1) $(MAN5) $(MAN7)
52 fontsubdir=$(fontdir)/dev$(DEV)
54 all install install_bin install_data TAGS depend distfiles uninstall_sub:
56 install: prefix_must_exist install_bin install_data
57 uninstall: uninstall_sub
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
68 echo The prefix directory \`$(prefix)\' doesn\'t exist; \
73 -rm -f $(MOSTLYCLEANFILES)
74 -rm -rf $(CLEANDIRADD)
75 -@if test `cd $(srcdir); pwd` = `pwd`; then \
78 rm -f $(CLEANNOTSRCDIRADD); \
85 -rm -f $(DISTCLEANFILES)
86 -@if test `cd $(srcdir); pwd` = `pwd`; then \
89 rm -f $(YTABC) $(YTABH); \
93 -rm -f $(REALCLEANFILES)
96 -rm -f \#* *~ =* core junk grot old temp tmp tem *.new *.old *.orig
99 .SUFFIXES: .o .obj .cpp .c .y .man .n
102 $(COMPILE.cpp) $(EXTRA_CCFLAGS) $<
105 $(COMPILE.c) $(EXTRA_CFLAGS) $<
108 $(COMPILE.cpp) $(EXTRA_CCFLAGS) $<
111 $(COMPILE.c) $(EXTRA_CFLAGS) $<
114 if test -n "$(YTABH)"; then \
115 $(YACC) $(YACCFLAGS) -d $<; \
117 $(YACC) $(YACCFLAGS) $<; \
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
122 test -z "$(YTABH)" || mv y_tab.h $(YTABH)
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).
127 if test -n "$(YTABH)"; then \
128 $(YACC) $(YACCFLAGS) -d $<; \
130 $(YACC) $(YACCFLAGS) $<; \
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
135 test -z "$(YTABH)" || mv y_tab.h $(YTABH)
136 $(COMPILE.cpp) $(EXTRA_CCFLAGS) $(YTABC)
139 @echo Making $@ from $<
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|@PDFDOCDIR@|$(pdfdocdir)|g" \
152 -e "s|@DEVICE@|$(DEVICE)|g" \
153 -e "s|@DEFAULT_INDEX@|$(indexdir)/$(indexname)|g" \
154 -e "s|@DEFAULT_INDEX_NAME@|$(indexname)|g" \
155 -e "s|@INDEX_SUFFIX@|$(indexext)|g" \
156 -e "s|@COMMON_WORDS_FILE@|$(common_words_file)|g" \
157 -e "s|@MAN1EXT@|$(man1ext)|g" \
158 -e "s|@MAN5EXT@|$(man5ext)|g" \
159 -e "s|@MAN7EXT@|$(man7ext)|g" \
160 -e "s|@TMAC_S_PREFIX@|$(tmac_s_prefix)|g" \
161 -e "s|@TMAC_M_PREFIX@|$(tmac_m_prefix)|g" \
162 -e "s|@TMAC_AN_PREFIX@|$(tmac_an_prefix)|g" \
163 -e "s|@TMAC_MDIR@|$(tmacdir)/mm|g" \
164 -e "s|@BROKEN_SPOOLER_FLAGS@|$(BROKEN_SPOOLER_FLAGS)|g" \
165 -e "s|@VERSION@|$(version)$(revision)|g" \
166 -e "s|@MDATE@|`$(SHELL) $(top_srcdir)/mdate.sh $<`|g" \
168 -e "s!@G@!`echo $(g) | tr [a-z] [A-Z]`!g" \
173 -test -d $(manroot) || $(mkinstalldirs) $(manroot)
174 -test -d $(man1dir) || $(mkinstalldirs) $(man1dir)
176 for p in $$pages; do \
177 prog=`basename $$p .n`; \
178 target=$(man1dir)/$(NAMEPREFIX)$$prog.$(man1ext); \
180 echo $(INSTALL_DATA) $$p $$target; \
181 $(INSTALL_DATA) $$p $$target; \
183 -test -d $(man5dir) || $(mkinstalldirs) $(man5dir)
185 for p in $$pages; do \
186 target=$(man5dir)/`basename $$p .n`.$(man5ext); \
188 echo $(INSTALL_DATA) $$p $$target; \
189 $(INSTALL_DATA) $$p $$target; \
191 -test -d $(man7dir) || $(mkinstalldirs) $(man7dir)
193 for p in $$pages; do \
194 target=$(man7dir)/`basename $$p .n`.$(man7ext); \
196 echo $(INSTALL_DATA) $$p $$target; \
197 $(INSTALL_DATA) $$p $$target; \
200 .PHONY: uninstall_man
203 for p in $$pages; do \
204 target=$(man1dir)/$(NAMEPREFIX)`basename $$p .n`.$(man1ext); \
205 echo rm -f $$target; \
209 for p in $$pages; do \
210 target=$(man5dir)/`basename $$p .n`.$(man5ext); \
211 echo rm -f $$target; \
215 for p in $$pages; do \
216 target=$(man7dir)/`basename $$p .n`.$(man7ext); \
217 echo rm -f $$target; \
223 -test -d $(bindir) || $(mkinstalldirs) $(bindir)
224 rm -f $(bindir)/$(NAMEPREFIX)$(PROG)
225 $(INSTALL_PROGRAM) $(PROG) $(bindir)/$(NAMEPREFIX)$(PROG)
227 .PHONY: uninstall_prog
229 -rm -f $(bindir)/$(NAMEPREFIX)$(PROG)
233 -test -d $(datadir) || $(mkinstalldirs) $(datadir)
234 -test -d $(dataprogramdir) || $(mkinstalldirs) $(dataprogramdir)
235 -test -d $(datasubdir) || $(mkinstalldirs) $(datasubdir)
236 -test -d $(fontdir) || $(mkinstalldirs) $(fontdir)
237 -test -d $(fontsubdir) || $(mkinstalldirs) $(fontsubdir)
238 -if test -d $(srcdir)/generate; then \
239 test -d $(fontsubdir)/generate \
240 || $(mkinstalldirs) $(fontsubdir)/generate; \
242 -test -z "$(DEVFILES)" \
243 || for f in ""$(DEVFILES); do \
244 rm -f $(fontsubdir)/$$f; \
245 if test -f $$f; then \
246 $(INSTALL_DATA) $$f $(fontsubdir)/$$f; \
248 $(INSTALL_DATA) $(srcdir)/$$f $(fontsubdir)/$$f; \
251 -test -z "$(DEVSCRIPTS)" \
252 || for f in ""$(DEVSCRIPTS); do \
253 rm -f $(fontsubdir)/$$f; \
254 if test -f $$f; then \
255 $(INSTALL_SCRIPT) $$f $(fontsubdir)/$$f; \
257 $(INSTALL_SCRIPT) $(srcdir)/$$f $(fontsubdir)/$$f; \
261 .PHONY: uninstall_dev
263 -test -z "$(DEVFILES)$(DEVSCRIPTS)" \
264 || for f in ""$(DEVFILES) $(DEVSCRIPTS); do \
265 rm -f $(fontsubdir)/$$f; \
267 -test -d $(fontsubdir)/generate && rmdir $(fontsubdir)/generate
271 depend_src: depend.temp
272 mv depend.temp Makefile.dep
276 if test -f "$(srcdir)/$(YTABC)"; then \
277 ytabc="$(srcdir)/$(YTABC)"; \
281 test -z "$(CCSRCS)$(YTABC)" \
282 || $(CCC) $(ALL_CCFLAGS) -MM $(CCSRCS) $$ytabc >>depend.temp
284 || $(CC) $(ALL_CFLAGS) -MM $(CSRCS) >>depend.temp
286 || (sed -e 's|$(YTABH)|$(YTABC)|g' depend.temp >depend1.temp; \
287 mv depend1.temp depend.temp)
291 $(ETAGS) $(ETAGSFLAGS) $(CCSRCS) $(CSRCS)
292 test -z "$(GRAM)$(HDRS)" \
293 || $(ETAGS) $(ETAGSFLAGS) -a $(ETAGSCCFLAG) $(GRAM) $(HDRS)
295 # This rule is only considered for the subdir_Makefile target.
298 echo srcdir=$(srcdir) >>Makefile
299 echo VPATH=$(VPATH) >>Makefile
300 cat $(MAKEFILEPARTS) /dev/null >>Makefile