1 # Copyright (C) 1989-2000, 2002, 2003, 2004, 2006, 2007
2 # Free Software Foundation, Inc.
3 # Written by James Clark (jjc@jclark.com)
5 # This file is part of groff.
7 # groff is free software; you can redistribute it and/or modify it under
8 # the terms of the GNU General Public License as published by the Free
9 # Software Foundation; either version 2, or (at your option) any later
12 # groff is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 # You should have received a copy of the GNU General Public License along
18 # with groff; see the file COPYING. If not, write to the Free Software
19 # Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, 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.cpp=$(CCC) $(ALL_CCFLAGS) -c
27 ALL_CFLAGS=$(INCLUDES) $(CDEFINES) $(CFLAGS) $(CPPFLAGS)
28 COMPILE.c=$(CC) $(ALL_CFLAGS) -c
29 LINK.cpp=$(CCC) $(CCFLAGS) $(LDFLAGS)
30 LINK.c=$(CC) $(CFLAGS) $(LDFLAGS)
31 LIBGROFF=$(top_builddir)/src/libs/libgroff/libgroff.$(LIBEXT)
32 LIBBIB=$(top_builddir)/src/libs/libbib/libbib.$(LIBEXT)
33 LIBDRIVER=$(top_builddir)/src/libs/libdriver/libdriver.$(LIBEXT)
34 LIBXUTIL=$(top_builddir)/src/libs/libxutil/libxutil.$(LIBEXT)
44 MOSTLYCLEANFILES=$(MANCLEAN) $(PROG) $(OBJS) $(GENSRCS) $(GENHDRS) \
45 depend.temp core y.output $(CLEANADD)
46 CLEANFILES=$(LIBCLEAN)
47 DISTCLEANFILES=TAGS Makefile Makefile.dep
48 REALCLEANFILES=$(YTABC) $(YTABH)
51 MANPAGES=$(MAN1) $(MAN5) $(MAN7)
53 fontsubdir=$(fontdir)/dev$(DEV)
54 oldfontsubdir=$(oldfontdir)/dev$(DEV)
56 all do_install install_bin install_data TAGS depend distfiles uninstall_sub:
58 do_install: install_bin install_data
59 uninstall: uninstall_sub
63 .PHONY: all clean distclean mostlyclean realclean extraclean depend distfiles
64 .PHONY: install install_bin install_data
65 .PHONY: uninstall uninstall_sub
69 -rm -f $(MOSTLYCLEANFILES)
70 -rm -rf $(CLEANDIRADD)
71 -@if test `cd $(srcdir); pwd` = `pwd`; then \
74 rm -f $(CLEANNOTSRCDIRADD); \
81 -rm -f $(DISTCLEANFILES)
82 -@if test `cd $(srcdir); pwd` = `pwd`; then \
85 rm -f $(YTABC) $(YTABH); \
89 -rm -f $(REALCLEANFILES)
92 -rm -f \#* *~ =* core junk grot old temp tmp tem *.new *.old *.orig
95 .SUFFIXES: .o .obj .cpp .c .y .man .n
98 $(COMPILE.cpp) $(EXTRA_CCFLAGS) $<
101 $(COMPILE.c) $(EXTRA_CFLAGS) $<
104 $(COMPILE.cpp) $(EXTRA_CCFLAGS) $<
107 $(COMPILE.c) $(EXTRA_CFLAGS) $<
110 if test -n "$(YTABH)"; then \
111 $(YACC) $(YACCFLAGS) -d $<; \
113 $(YACC) $(YACCFLAGS) $<; \
115 -test -f y.tab.h && mv y.tab.h y_tab.h
116 -test -f y.tab.c && mv y.tab.c y_tab.c
117 sed "s/^#line \(.*\) \"y.tab.c\"/#line \1 \"$(YTABC)\"/" \
120 test -z "$(YTABH)" || mv y_tab.h $(YTABH)
122 # The next rule is needed for make of Solaris 2.5.1 to override its
123 # built-in .y.o rule (which takes precedence over the .y.cpp rule above).
125 if test -n "$(YTABH)"; then \
126 $(YACC) $(YACCFLAGS) -d $<; \
128 $(YACC) $(YACCFLAGS) $<; \
130 -test -f y.tab.h && mv y.tab.h y_tab.h
131 -test -f y.tab.c && mv y.tab.c y_tab.c
133 test -z "$(YTABH)" || mv y_tab.h $(YTABH)
134 $(COMPILE.cpp) $(EXTRA_CCFLAGS) $(YTABC)
137 @echo Making $@ from $<
139 @sed -e "s|@APPRESDIR@|$(appresdir)|g" \
140 -e "s|@BINDIR@|$(bindir)|g" \
141 -e "s|@BROKEN_SPOOLER_FLAGS@|$(BROKEN_SPOOLER_FLAGS)|g" \
142 -e "s|@COMMON_WORDS_FILE@|$(common_words_file)|g" \
143 -e "s|@DATASUBDIR@|$(datasubdir)|g" \
144 -e "s|@DEFAULT_INDEX@|$(indexdir)/$(indexname)|g" \
145 -e "s|@DEFAULT_INDEX_NAME@|$(indexname)|g" \
146 -e "s|@DEVICE@|$(DEVICE)|g" \
147 -e "s|@DOCDIR@|$(docdir)|g" \
148 -e "s|@EXAMPLEDIR@|$(exampledir)|g" \
149 -e "s|@FONTDIR@|$(fontdir)|g" \
151 -e "s!@G@!`echo $(g) | tr [a-z] [A-Z]`!g" \
152 -e "s|@HTMLDOCDIR@|$(htmldocdir)|g" \
153 -e "s|@INDEX_SUFFIX@|$(indexext)|g" \
154 -e "s|@LEGACYFONTDIR@|$(legacyfontdir)|g" \
155 -e "s|@LOCALFONTDIR@|$(localfontdir)|g" \
156 -e "s|@LOCALMACRODIR@|$(localtmacdir)|g" \
157 -e "s|@MACRODIR@|$(tmacdir)|g" \
158 -e "s|@MAN1EXT@|$(man1ext)|g" \
159 -e "s|@MAN5EXT@|$(man5ext)|g" \
160 -e "s|@MAN7EXT@|$(man7ext)|g" \
161 -e "s|@MDATE@|`$(SHELL) $(top_srcdir)/mdate.sh $<`|g" \
162 -e "s|@OLDFONTDIR@|$(oldfontdir)|g" \
163 -e "s|@PDFDOCDIR@|$(pdfdocdir)|g" \
164 -e "s|@SYSTEMMACRODIR@|$(systemtmacdir)|g" \
165 -e "s|@TMAC_AN_PREFIX@|$(tmac_an_prefix)|g" \
166 -e "s|@TMAC_M_PREFIX@|$(tmac_m_prefix)|g" \
167 -e "s|@TMAC_MDIR@|$(tmacdir)/mm|g" \
168 -e "s|@TMAC_S_PREFIX@|$(tmac_s_prefix)|g" \
169 -e "s|@VERSION@|$(version)$(revision)|g" \
174 -test -d $(DESTDIR)$(manroot) || $(mkinstalldirs) $(DESTDIR)$(manroot)
175 -test -d $(DESTDIR)$(man1dir) || $(mkinstalldirs) $(DESTDIR)$(man1dir)
177 for p in $$pages; do \
178 prog=`basename $$p .n`; \
179 target=$(DESTDIR)$(man1dir)/$(NAMEPREFIX)$$prog.$(man1ext); \
181 echo $(INSTALL_DATA) $$p $$target; \
182 $(INSTALL_DATA) $$p $$target; \
184 -test -d $(DESTDIR)$(man5dir) || $(mkinstalldirs) $(DESTDIR)$(man5dir)
186 for p in $$pages; do \
187 target=$(DESTDIR)$(man5dir)/`basename $$p .n`.$(man5ext); \
189 echo $(INSTALL_DATA) $$p $$target; \
190 $(INSTALL_DATA) $$p $$target; \
192 -test -d $(DESTDIR)$(man7dir) || $(mkinstalldirs) $(DESTDIR)$(man7dir)
194 for p in $$pages; do \
195 target=$(DESTDIR)$(man7dir)/`basename $$p .n`.$(man7ext); \
197 echo $(INSTALL_DATA) $$p $$target; \
198 $(INSTALL_DATA) $$p $$target; \
201 .PHONY: uninstall_man
204 for p in $$pages; do \
205 target=$(DESTDIR)$(man1dir)/$(NAMEPREFIX)`basename $$p .n`.$(man1ext); \
206 echo rm -f $$target; \
210 for p in $$pages; do \
211 target=$(DESTDIR)$(man5dir)/`basename $$p .n`.$(man5ext); \
212 echo rm -f $$target; \
216 for p in $$pages; do \
217 target=$(DESTDIR)$(man7dir)/`basename $$p .n`.$(man7ext); \
218 echo rm -f $$target; \
224 -test -d $(DESTDIR)$(bindir) || $(mkinstalldirs) $(DESTDIR)$(bindir)
225 rm -f $(DESTDIR)$(bindir)/$(NAMEPREFIX)$(PROG)
226 $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(bindir)/$(NAMEPREFIX)$(PROG)
228 .PHONY: uninstall_prog
230 -rm -f $(DESTDIR)$(bindir)/$(NAMEPREFIX)$(PROG)
234 -test -d $(DESTDIR)$(datadir) \
235 || $(mkinstalldirs) $(DESTDIR)$(datadir)
236 -test -d $(DESTDIR)$(dataprogramdir) \
237 || $(mkinstalldirs) $(DESTDIR)$(dataprogramdir)
238 -test -d $(DESTDIR)$(datasubdir) \
239 || $(mkinstalldirs) $(DESTDIR)$(datasubdir)
240 -test -d $(DESTDIR)$(fontdir) \
241 || $(mkinstalldirs) $(DESTDIR)$(fontdir)
242 -test -d $(DESTDIR)$(fontsubdir) \
243 || $(mkinstalldirs) $(DESTDIR)$(fontsubdir)
244 -if test -d $(srcdir)/generate; then \
245 test -d $(DESTDIR)$(fontsubdir)/generate \
246 || $(mkinstalldirs) $(DESTDIR)$(fontsubdir)/generate; \
248 -if test -d $(srcdir)/old; then \
249 test -d $(DESTDIR)$(oldfontdir) \
250 || $(mkinstalldirs) $(DESTDIR)$(oldfontdir); \
251 test -d $(DESTDIR)$(oldfontsubdir) \
252 || $(mkinstalldirs) $(DESTDIR)$(oldfontsubdir); \
254 -test -z "$(DEVFILES)" \
255 || for f in ""$(DEVFILES); do \
256 rm -f $(DESTDIR)$(fontsubdir)/$$f; \
257 if test -f $$f; then \
258 $(INSTALL_DATA) $$f $(DESTDIR)$(fontsubdir)/$$f; \
260 $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(fontsubdir)/$$f; \
263 -test -z "$(OLDDEVFILES)" \
264 || for f in ""$(OLDDEVFILES); do \
265 rm -f $(DESTDIR)$(oldfontsubdir)/$$f; \
266 $(INSTALL_DATA) $(srcdir)/old/$$f $(DESTDIR)$(oldfontsubdir)/$$f; \
268 -test -z "$(DEVSCRIPTS)" \
269 || for f in ""$(DEVSCRIPTS); do \
270 rm -f $(DESTDIR)$(fontsubdir)/$$f; \
271 if test -f $$f; then \
272 $(INSTALL_SCRIPT) $$f $(DESTDIR)$(fontsubdir)/$$f; \
274 $(INSTALL_SCRIPT) $(srcdir)/$$f $(DESTDIR)$(fontsubdir)/$$f; \
278 .PHONY: uninstall_dev
280 -test -z "$(DEVFILES)$(DEVSCRIPTS)" \
281 || for f in ""$(DEVFILES) $(DEVSCRIPTS); do \
282 rm -f $(DESTDIR)$(fontsubdir)/$$f; \
284 -test -z "$(OLDDEVFILES)" \
285 || for f in ""$(OLDDEVFILES); do \
286 rm -f $(DESTDIR)$(oldfontsubdir)/$$f; \
288 -test -d $(DESTDIR)$(fontsubdir)/generate \
289 && rmdir $(DESTDIR)$(fontsubdir)/generate
290 -rmdir $(DESTDIR)$(fontsubdir)
291 -rmdir $(DESTDIR)$(oldfontsubdir)
294 depend_src: depend.temp
295 mv depend.temp Makefile.dep
299 if test -f "$(srcdir)/$(YTABC)"; then \
300 ytabc="$(srcdir)/$(YTABC)"; \
304 test -z "$(CCSRCS)$(YTABC)" \
305 || $(CCC) $(ALL_CCFLAGS) -MM $(CCSRCS) $$ytabc >>depend.temp
307 || $(CC) $(ALL_CFLAGS) -MM $(CSRCS) >>depend.temp
309 || (sed -e 's|$(YTABH)|$(YTABC)|g' depend.temp >depend1.temp; \
310 mv depend1.temp depend.temp)
314 $(ETAGS) $(ETAGSFLAGS) $(CCSRCS) $(CSRCS)
315 test -z "$(GRAM)$(HDRS)" \
316 || $(ETAGS) $(ETAGSFLAGS) -a $(ETAGSCCFLAG) $(GRAM) $(HDRS)
318 # This rule is only considered for the subdir_Makefile target.
321 echo srcdir=$(srcdir) >>Makefile
322 echo VPATH=$(VPATH) >>Makefile
323 cat $(MAKEFILEPARTS) /dev/null >>Makefile