1 # Copyright (C) 1989-2000, 2002-2004, 2006-2011
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 3 of the License, or
10 # (at your option) any later version.
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
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
22 INCLUDES=-I. -I$(srcdir) \
23 -I$(top_builddir)/src/include -I$(top_srcdir)/src/include \
24 -I$(top_builddir)/src/libs/gnulib/lib
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)
35 LIBGNU=$(top_builddir)/src/libs/gnulib/lib/libgnu.$(LIBEXT)
44 MOSTLYCLEANNOTSRCDIRADD=
45 MOSTLYCLEANFILES=$(MANCLEAN) $(PROG) $(OBJS) $(GENSRCS) $(GENHDRS) \
46 depend.temp core y.output $(MOSTLYCLEANADD)
47 CLEANFILES=$(LIBCLEAN)
48 DISTCLEANFILES=TAGS Makefile Makefile.dep
49 REALCLEANFILES=$(YTABC) $(YTABH)
52 MANPAGES=$(MAN1) $(MAN5) $(MAN7)
54 fontsubdir=$(fontdir)/dev$(DEV)
55 oldfontsubdir=$(oldfontdir)/dev$(DEV)
57 all do_install install_bin install_data TAGS depend distfiles uninstall_sub:
59 do_install: install_bin install_data
60 uninstall: uninstall_sub
64 .PHONY: all clean distclean mostlyclean realclean extraclean depend distfiles
65 .PHONY: install install_bin install_data
66 .PHONY: uninstall uninstall_sub
70 -rm -f $(MOSTLYCLEANFILES)
71 -rm -rf $(MOSTLYCLEANDIRADD)
72 -@if test `cd $(srcdir); pwd` = `pwd`; then \
75 rm -f $(MOSTLYCLEANNOTSRCDIRADD); \
82 -rm -f $(DISTCLEANFILES)
83 -@if test `cd $(srcdir); pwd` = `pwd`; then \
86 rm -f $(YTABC) $(YTABH); \
90 -rm -f $(REALCLEANFILES)
93 -rm -f \#* *~ =* core junk grot old temp tmp tem *.new *.old *.orig
96 .SUFFIXES: .o .obj .cpp .c .y .man .n
99 $(COMPILE.cpp) $(EXTRA_CCFLAGS) $<
102 $(COMPILE.c) $(EXTRA_CFLAGS) $<
105 $(COMPILE.cpp) $(EXTRA_CCFLAGS) $<
108 $(COMPILE.c) $(EXTRA_CFLAGS) $<
111 if test -n "$(YTABH)"; then \
112 $(YACC) $(YACCFLAGS) -d $<; \
114 $(YACC) $(YACCFLAGS) $<; \
116 -test -f y.tab.h && mv y.tab.h y_tab.h
117 -test -f y.tab.c && mv y.tab.c y_tab.c
118 sed "s/^#line \(.*\) \"y.tab.c\"/#line \1 \"$(YTABC)\"/" \
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) $(EXTRA_CCFLAGS) $(YTABC)
138 @echo Making $@ from $<
140 @sed -e "s|@APPRESDIR@|$(appresdir)|g" \
141 -e "s|@BINDIR@|$(bindir)|g" \
142 -e "s|@BROKEN_SPOOLER_FLAGS@|$(BROKEN_SPOOLER_FLAGS)|g" \
143 -e "s|@COMMON_WORDS_FILE@|$(common_words_file)|g" \
144 -e "s|@DATASUBDIR@|$(datasubdir)|g" \
145 -e "s|@DEFAULT_INDEX@|$(indexdir)/$(indexname)|g" \
146 -e "s|@DEFAULT_INDEX_NAME@|$(indexname)|g" \
147 -e "s|@DEVICE@|$(DEVICE)|g" \
148 -e "s|@DOCDIR@|$(docdir)|g" \
149 -e "s|@EXAMPLEDIR@|$(exampledir)|g" \
150 -e "s|@FONTDIR@|$(fontdir)|g" \
152 -e "s!@G@!`echo $(g) | tr [a-z] [A-Z]`!g" \
153 -e "s|@HTMLDOCDIR@|$(htmldocdir)|g" \
154 -e "s|@INDEX_SUFFIX@|$(indexext)|g" \
155 -e "s|@LEGACYFONTDIR@|$(legacyfontdir)|g" \
156 -e "s|@LOCALFONTDIR@|$(localfontdir)|g" \
157 -e "s|@LOCALMACRODIR@|$(localtmacdir)|g" \
158 -e "s|@MACRODIR@|$(tmacdir)|g" \
159 -e "s|@MAN1EXT@|$(man1ext)|g" \
160 -e "s|@MAN5EXT@|$(man5ext)|g" \
161 -e "s|@MAN7EXT@|$(man7ext)|g" \
162 -e "s|@MDATE@|`$(SHELL) $(top_srcdir)/mdate.sh $<`|g" \
163 -e "s|@OLDFONTDIR@|$(oldfontdir)|g" \
164 -e "s|@PDFDOCDIR@|$(pdfdocdir)|g" \
165 -e "s|@SYSTEMMACRODIR@|$(systemtmacdir)|g" \
166 -e "s|@TMAC_AN_PREFIX@|$(tmac_an_prefix)|g" \
167 -e "s|@TMAC_M_PREFIX@|$(tmac_m_prefix)|g" \
168 -e "s|@TMAC_MDIR@|$(tmacdir)/mm|g" \
169 -e "s|@TMAC_S_PREFIX@|$(tmac_s_prefix)|g" \
170 -e "s|@VERSION@|$(version)$(revision)|g" \
175 -test -d $(DESTDIR)$(manroot) || $(mkinstalldirs) $(DESTDIR)$(manroot)
176 -test -d $(DESTDIR)$(man1dir) || $(mkinstalldirs) $(DESTDIR)$(man1dir)
178 for p in $$pages; do \
179 prog=`basename $$p .n`; \
180 target=$(DESTDIR)$(man1dir)/$(NAMEPREFIX)$$prog.$(man1ext); \
182 echo $(INSTALL_DATA) $$p $$target; \
183 $(INSTALL_DATA) $$p $$target; \
185 -test -d $(DESTDIR)$(man5dir) || $(mkinstalldirs) $(DESTDIR)$(man5dir)
187 for p in $$pages; do \
188 target=$(DESTDIR)$(man5dir)/`basename $$p .n`.$(man5ext); \
190 echo $(INSTALL_DATA) $$p $$target; \
191 $(INSTALL_DATA) $$p $$target; \
193 -test -d $(DESTDIR)$(man7dir) || $(mkinstalldirs) $(DESTDIR)$(man7dir)
195 for p in $$pages; do \
196 target=$(DESTDIR)$(man7dir)/`basename $$p .n`.$(man7ext); \
198 echo $(INSTALL_DATA) $$p $$target; \
199 $(INSTALL_DATA) $$p $$target; \
202 .PHONY: uninstall_man
205 for p in $$pages; do \
206 target=$(DESTDIR)$(man1dir)/$(NAMEPREFIX)`basename $$p .n`.$(man1ext); \
207 echo rm -f $$target; \
211 for p in $$pages; do \
212 target=$(DESTDIR)$(man5dir)/`basename $$p .n`.$(man5ext); \
213 echo rm -f $$target; \
217 for p in $$pages; do \
218 target=$(DESTDIR)$(man7dir)/`basename $$p .n`.$(man7ext); \
219 echo rm -f $$target; \
225 -test -d $(DESTDIR)$(bindir) || $(mkinstalldirs) $(DESTDIR)$(bindir)
226 rm -f $(DESTDIR)$(bindir)/$(NAMEPREFIX)$(PROG)
227 $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(bindir)/$(NAMEPREFIX)$(PROG)
229 .PHONY: uninstall_prog
231 -rm -f $(DESTDIR)$(bindir)/$(NAMEPREFIX)$(PROG)
235 -test -d $(DESTDIR)$(datadir) \
236 || $(mkinstalldirs) $(DESTDIR)$(datadir)
237 -test -d $(DESTDIR)$(dataprogramdir) \
238 || $(mkinstalldirs) $(DESTDIR)$(dataprogramdir)
239 -test -d $(DESTDIR)$(datasubdir) \
240 || $(mkinstalldirs) $(DESTDIR)$(datasubdir)
241 -test -d $(DESTDIR)$(fontdir) \
242 || $(mkinstalldirs) $(DESTDIR)$(fontdir)
243 -test -d $(DESTDIR)$(fontsubdir) \
244 || $(mkinstalldirs) $(DESTDIR)$(fontsubdir)
245 -if test -d $(srcdir)/generate; then \
246 test -d $(DESTDIR)$(fontsubdir)/generate \
247 || $(mkinstalldirs) $(DESTDIR)$(fontsubdir)/generate; \
249 -if test -d $(srcdir)/enc; then \
250 test -d $(DESTDIR)$(fontsubdir)/enc \
251 || $(mkinstalldirs) $(DESTDIR)$(fontsubdir)/enc; \
253 -if test -d $(srcdir)/map; then \
254 test -d $(DESTDIR)$(fontsubdir)/map \
255 || $(mkinstalldirs) $(DESTDIR)$(fontsubdir)/map; \
257 -if test -d $(srcdir)/util; then \
258 test -d $(DESTDIR)$(fontsubdir)/util \
259 || $(mkinstalldirs) $(DESTDIR)$(fontsubdir)/util; \
261 -if test -d $(srcdir)/old; then \
262 test -d $(DESTDIR)$(oldfontdir) \
263 || $(mkinstalldirs) $(DESTDIR)$(oldfontdir); \
264 test -d $(DESTDIR)$(oldfontsubdir) \
265 || $(mkinstalldirs) $(DESTDIR)$(oldfontsubdir); \
267 -test -z "$(DEVFILES)" \
268 || for f in ""$(DEVFILES); do \
269 rm -f $(DESTDIR)$(fontsubdir)/$$f; \
270 if test -f $$f; then \
271 $(INSTALL_DATA) $$f $(DESTDIR)$(fontsubdir)/$$f; \
273 $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(fontsubdir)/$$f; \
276 -test -z "$(OLDDEVFILES)" \
277 || for f in ""$(OLDDEVFILES); do \
278 rm -f $(DESTDIR)$(oldfontsubdir)/$$f; \
279 $(INSTALL_DATA) $(srcdir)/old/$$f $(DESTDIR)$(oldfontsubdir)/$$f; \
281 -test -z "$(DEVSCRIPTS)" \
282 || for f in ""$(DEVSCRIPTS); do \
283 rm -f $(DESTDIR)$(fontsubdir)/$$f; \
284 if test -f $$f; then \
285 $(INSTALL_SCRIPT) $$f $(DESTDIR)$(fontsubdir)/$$f; \
287 $(INSTALL_SCRIPT) $(srcdir)/$$f $(DESTDIR)$(fontsubdir)/$$f; \
291 .PHONY: uninstall_dev
293 -test -z "$(DEVFILES)$(DEVSCRIPTS)" \
294 || for f in ""$(DEVFILES) $(DEVSCRIPTS); do \
295 rm -f $(DESTDIR)$(fontsubdir)/$$f; \
297 -test -z "$(OLDDEVFILES)" \
298 || for f in ""$(OLDDEVFILES); do \
299 rm -f $(DESTDIR)$(oldfontsubdir)/$$f; \
301 -test -d $(DESTDIR)$(fontsubdir)/generate \
302 && rmdir $(DESTDIR)$(fontsubdir)/generate
303 -test -d $(DESTDIR)$(fontsubdir)/enc \
304 && rmdir $(DESTDIR)$(fontsubdir)/enc
305 -test -d $(DESTDIR)$(fontsubdir)/map \
306 && rmdir $(DESTDIR)$(fontsubdir)/map
307 -test -d $(DESTDIR)$(fontsubdir)/util \
308 && rmdir $(DESTDIR)$(fontsubdir)/util
309 -rmdir $(DESTDIR)$(fontsubdir)
310 -rmdir $(DESTDIR)$(oldfontsubdir)
313 depend_src: depend.temp
314 mv depend.temp Makefile.dep
318 if test -f "$(srcdir)/$(YTABC)"; then \
319 ytabc="$(srcdir)/$(YTABC)"; \
323 test -z "$(CCSRCS)$(YTABC)" \
324 || $(CCC) $(ALL_CCFLAGS) $(EXTRA_CCFLAGS) -MM $(CCSRCS) $$ytabc >>depend.temp
326 || $(CC) $(ALL_CFLAGS) $(EXTRA_CFLAGS) -MM $(CSRCS) >>depend.temp
328 || (sed -e 's|$(YTABH)|$(YTABC)|g' depend.temp >depend1.temp; \
329 mv depend1.temp depend.temp)
333 $(ETAGS) $(ETAGSFLAGS) $(CCSRCS) $(CSRCS)
334 test -z "$(GRAM)$(HDRS)" \
335 || $(ETAGS) $(ETAGSFLAGS) -a $(ETAGSCCFLAG) $(GRAM) $(HDRS)
337 # This rule is only considered for the subdir_Makefile target.
340 echo srcdir=$(srcdir) >>Makefile
341 echo VPATH=$(VPATH) >>Makefile
342 cat $(MAKEFILEPARTS) /dev/null >>Makefile