1 # Copyright (C) 1989-2000, 2002, 2003 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.
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)
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)
74 -@if test `cd $(srcdir); pwd` = `pwd`; then \
77 rm -f $(CLEANNOTSRCDIRADD); \
84 -rm -f $(DISTCLEANFILES)
85 -@if test `cd $(srcdir); pwd` = `pwd`; then \
88 rm -f $(YTABC) $(YTABH); \
92 -rm -f $(REALCLEANFILES)
95 -rm -f \#* *~ =* core junk grot old temp tmp tem
98 .SUFFIXES: .o .obj .cpp .c .y .man .n
113 if test -n "$(YTABH)"; then \
114 $(YACC) $(YACCFLAGS) -d $<; \
116 $(YACC) $(YACCFLAGS) $<; \
118 -test -f y.tab.h && mv y.tab.h y_tab.h
119 -test -f y.tab.c && mv y.tab.c y_tab.c
121 test -z "$(YTABH)" || mv y_tab.h $(YTABH)
123 # The next rule is needed for make of Solaris 2.5.1 to override its
124 # built-in .y.o rule (which takes precedence over the .y.cpp rule above).
126 if test -n "$(YTABH)"; then \
127 $(YACC) $(YACCFLAGS) -d $<; \
129 $(YACC) $(YACCFLAGS) $<; \
131 -test -f y.tab.h && mv y.tab.h y_tab.h
132 -test -f y.tab.c && mv y.tab.c y_tab.c
134 test -z "$(YTABH)" || mv y_tab.h $(YTABH)
135 $(COMPILE.cpp) $(YTABC)
138 @echo Making $@ from $<
140 @sed -e "s|@BINDIR@|$(bindir)|g" \
141 -e "s|@FONTDIR@|$(fontdir)|g" \
142 -e "s|@LOCALFONTDIR@|$(localfontdir)|g" \
143 -e "s|@LEGACYFONTDIR@|$(legacyfontdir)|g" \
144 -e "s|@MACRODIR@|$(tmacdir)|g" \
145 -e "s|@SYSTEMMACRODIR@|$(systemtmacdir)|g" \
146 -e "s|@LOCALMACRODIR@|$(localtmacdir)|g" \
147 -e "s|@DOCDIR@|$(docdir)|g" \
148 -e "s|@EXAMPLEDIR@|$(exampledir)|g" \
149 -e "s|@HTMLDOCDIR@|$(htmldocdir)|g" \
150 -e "s|@DEVICE@|$(DEVICE)|g" \
151 -e "s|@DEFAULT_INDEX@|$(indexdir)/$(indexname)|g" \
152 -e "s|@DEFAULT_INDEX_NAME@|$(indexname)|g" \
153 -e "s|@INDEX_SUFFIX@|$(indexext)|g" \
154 -e "s|@COMMON_WORDS_FILE@|$(common_words_file)|g" \
155 -e "s|@MAN1EXT@|$(man1ext)|g" \
156 -e "s|@MAN5EXT@|$(man5ext)|g" \
157 -e "s|@MAN7EXT@|$(man7ext)|g" \
158 -e "s|@TMAC_S_PREFIX@|$(tmac_s_prefix)|g" \
159 -e "s|@TMAC_M_PREFIX@|$(tmac_m_prefix)|g" \
160 -e "s|@TMAC_AN_PREFIX@|$(tmac_an_prefix)|g" \
161 -e "s|@TMAC_MDIR@|$(tmacdir)/mm|g" \
162 -e "s|@BROKEN_SPOOLER_FLAGS@|$(BROKEN_SPOOLER_FLAGS)|g" \
163 -e "s|@VERSION@|$(version)$(revision)|g" \
164 -e "s|@MDATE@|`$(SHELL) $(top_srcdir)/mdate.sh $<`|g" \
166 -e "s!@G@!`echo $(g) | tr [a-z] [A-Z]`!g" \
171 -test -d $(manroot) || $(mkinstalldirs) $(manroot)
172 -test -d $(man1dir) || $(mkinstalldirs) $(man1dir)
174 for p in $$pages; do \
175 prog=`basename $$p .n`; \
176 target=$(man1dir)/$(NAMEPREFIX)$$prog.$(man1ext); \
178 echo $(INSTALL_DATA) $$p $$target; \
179 $(INSTALL_DATA) $$p $$target; \
181 -test -d $(man5dir) || $(mkinstalldirs) $(man5dir)
183 for p in $$pages; do \
184 target=$(man5dir)/`basename $$p .n`.$(man5ext); \
186 echo $(INSTALL_DATA) $$p $$target; \
187 $(INSTALL_DATA) $$p $$target; \
189 -test -d $(man7dir) || $(mkinstalldirs) $(man7dir)
191 for p in $$pages; do \
192 target=$(man7dir)/`basename $$p .n`.$(man7ext); \
194 echo $(INSTALL_DATA) $$p $$target; \
195 $(INSTALL_DATA) $$p $$target; \
198 .PHONY: uninstall_man
201 for p in $$pages; do \
202 target=$(man1dir)/$(NAMEPREFIX)`basename $$p .n`.$(man1ext); \
203 echo rm -f $$target; \
207 for p in $$pages; do \
208 target=$(man5dir)/`basename $$p .n`.$(man5ext); \
209 echo rm -f $$target; \
213 for p in $$pages; do \
214 target=$(man7dir)/`basename $$p .n`.$(man7ext); \
215 echo rm -f $$target; \
221 -test -d $(bindir) || $(mkinstalldirs) $(bindir)
222 rm -f $(bindir)/$(NAMEPREFIX)$(PROG)
223 $(INSTALL_PROGRAM) $(PROG) $(bindir)/$(NAMEPREFIX)$(PROG)
225 .PHONY: uninstall_prog
227 -rm -f $(bindir)/$(NAMEPREFIX)$(PROG)
231 -test -d $(datadir) || $(mkinstalldirs) $(datadir)
232 -test -d $(dataprogramdir) || $(mkinstalldirs) $(dataprogramdir)
233 -test -d $(datasubdir) || $(mkinstalldirs) $(datasubdir)
234 -test -d $(fontdir) || $(mkinstalldirs) $(fontdir)
235 -test -d $(fontsubdir) || $(mkinstalldirs) $(fontsubdir)
236 -if test -d $(srcdir)/generate; then \
237 test -d $(fontsubdir)/generate \
238 || $(mkinstalldirs) $(fontsubdir)/generate; \
240 -test -z "$(DEVFILES)" \
241 || for f in $(DEVFILES); do \
242 rm -f $(fontsubdir)/$$f; \
243 if test -f $$f; then \
244 $(INSTALL_DATA) $$f $(fontsubdir)/$$f; \
246 $(INSTALL_DATA) $(srcdir)/$$f $(fontsubdir)/$$f; \
249 -test -z "$(DEVSCRIPTS)" \
250 || for f in $(DEVSCRIPTS); do \
251 rm -f $(fontsubdir)/$$f; \
252 if test -f $$f; then \
253 $(INSTALL_SCRIPT) $$f $(fontsubdir)/$$f; \
255 $(INSTALL_SCRIPT) $(srcdir)/$$f $(fontsubdir)/$$f; \
259 .PHONY: uninstall_dev
261 -test -z "$(DEVFILES)$(DEVSCRIPTS)" \
262 || for f in $(DEVFILES) $(DEVSCRIPTS); do \
263 rm -f $(fontsubdir)/$$f; \
265 -test -d $(fontsubdir)/generate && rmdir $(fontsubdir)/generate
269 depend_src: depend.temp
270 mv depend.temp Makefile.dep
274 if test -f "$(srcdir)/$(YTABC)"; then \
275 ytabc="$(srcdir)/$(YTABC)"; \
279 test -z "$(CCSRCS)$(YTABC)" \
280 || $(CCC) $(ALL_CCFLAGS) -MM $(CCSRCS) $$ytabc >>depend.temp
282 || $(CC) $(ALL_CFLAGS) -MM $(CSRCS) >>depend.temp
284 || (sed -e 's|$(YTABH)|$(YTABC)|g' depend.temp >depend1.temp; \
285 mv depend1.temp depend.temp)
289 $(ETAGS) $(ETAGSFLAGS) $(CCSRCS) $(CSRCS)
290 test -z "$(GRAM)$(HDRS)" \
291 || $(ETAGS) $(ETAGSFLAGS) -a $(ETAGSCCFLAG) $(GRAM) $(HDRS)
293 # This rule is only considered for the subdir_Makefile target.
296 echo srcdir=$(srcdir) >>Makefile
297 echo VPATH=$(VPATH) >>Makefile
298 cat $(MAKEFILEPARTS) /dev/null >>Makefile