1 # Copyright (C) 1989-2014 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 3 of the License, or
9 # (at your option) any later version.
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
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 INCLUDES=-I. -I$(srcdir) \
22 -I$(top_builddir)/src/include -I$(top_srcdir)/src/include \
23 -I$(top_builddir)/src/libs/gnulib/lib
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)
34 LIBGNU=$(top_builddir)/src/libs/gnulib/lib/libgnu.$(LIBEXT)
43 MOSTLYCLEANNOTSRCDIRADD=
44 MOSTLYCLEANFILES=$(MANCLEAN) $(PROG) $(OBJS) $(GENSRCS) $(GENHDRS) \
45 depend.temp core y.output $(MOSTLYCLEANADD)
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 $(MOSTLYCLEANDIRADD)
71 -@if test "`cd $(srcdir); pwd`" != "`pwd`"; then \
72 rm -f $(MOSTLYCLEANNOTSRCDIRADD); \
79 rm -f $(DISTCLEANFILES)
80 -@if test "`cd $(srcdir); pwd`" != "`pwd`"; then \
81 rm -f $(YTABC) $(YTABH); \
85 rm -f $(REALCLEANFILES)
88 rm -f \#* *~ =* core junk grot temp tmp tem *.new *.old *.orig
91 .SUFFIXES: .o .obj .cpp .c .y .man .n
94 $(COMPILE.cpp) $(EXTRA_CCFLAGS) $<
97 $(COMPILE.c) $(EXTRA_CFLAGS) $<
100 $(COMPILE.cpp) $(EXTRA_CCFLAGS) $<
103 $(COMPILE.c) $(EXTRA_CFLAGS) $<
106 if test -n "$(YTABH)"; then \
107 $(YACC) $(YACCFLAGS) -d $<; \
109 $(YACC) $(YACCFLAGS) $<; \
111 -test -f y.tab.h && mv y.tab.h y_tab.h
112 -test -f y.tab.c && mv y.tab.c y_tab.c
113 sed "s/^#line \(.*\) \"y.tab.c\"/#line \1 \"$(YTABC)\"/" \
116 test -z "$(YTABH)" || mv y_tab.h $(YTABH)
118 # The next rule is needed for make of Solaris 2.5.1 to override its
119 # built-in .y.o rule (which takes precedence over the .y.cpp rule above).
121 if test -n "$(YTABH)"; then \
122 $(YACC) $(YACCFLAGS) -d $<; \
124 $(YACC) $(YACCFLAGS) $<; \
126 -test -f y.tab.h && mv y.tab.h y_tab.h
127 -test -f y.tab.c && mv y.tab.c y_tab.c
129 test -z "$(YTABH)" || mv y_tab.h $(YTABH)
130 $(COMPILE.cpp) $(EXTRA_CCFLAGS) $(YTABC)
133 @echo Making $@ from $<
136 sed -e "s|@APPRESDIR@|$(appresdir)|g" \
137 -e "s|@BINDIR@|$(bindir)|g" \
138 -e "s|@BROKEN_SPOOLER_FLAGS@|$(BROKEN_SPOOLER_FLAGS)|g" \
139 -e "s|@COMMON_WORDS_FILE@|$(common_words_file)|g" \
140 -e "s|@DATASUBDIR@|$(datasubdir)|g" \
141 -e "s|@DEFAULT_INDEX@|$(indexdir)/$(indexname)|g" \
142 -e "s|@DEFAULT_INDEX_NAME@|$(indexname)|g" \
143 -e "s|@DEVICE@|$(DEVICE)|g" \
144 -e "s|@DOCDIR@|$(docdir)|g" \
145 -e "s|@EXAMPLEDIR@|$(exampledir)|g" \
146 -e "s|@FONTDIR@|$(fontdir)|g" \
148 -e "s!@G@!`echo $(g) | tr [a-z] [A-Z]`!g" \
149 -e "s|@HTMLDOCDIR@|$(htmldocdir)|g" \
150 -e "s|@INDEX_SUFFIX@|$(indexext)|g" \
151 -e "s|@LEGACYFONTDIR@|$(legacyfontdir)|g" \
152 -e "s|@LOCALFONTDIR@|$(localfontdir)|g" \
153 -e "s|@LOCALMACRODIR@|$(localtmacdir)|g" \
154 -e "s|@MACRODIR@|$(tmacdir)|g" \
155 -e "s|@MAN1EXT@|$(man1ext)|g" \
156 -e "s|@MAN5EXT@|$(man5ext)|g" \
157 -e "s|@MAN7EXT@|$(man7ext)|g" \
158 -e "s|@MDATE@|`$(SHELL) $(top_srcdir)/mdate.sh $<`|g" \
159 -e "s|@OLDFONTDIR@|$(oldfontdir)|g" \
160 -e "s|@PDFDOCDIR@|$(pdfdocdir)|g" \
161 -e "s|@SYSTEMMACRODIR@|$(systemtmacdir)|g" \
162 -e "s|@TMAC_AN_PREFIX@|$(tmac_an_prefix)|g" \
163 -e "s|@TMAC_M_PREFIX@|$(tmac_m_prefix)|g" \
164 -e "s|@TMAC_MDIR@|$(tmacdir)/mm|g" \
165 -e "s|@TMAC_S_PREFIX@|$(tmac_s_prefix)|g" \
166 -e "s|@VERSION@|$(version)$(revision)|g" \
171 -test -d $(DESTDIR)$(manroot) || $(mkinstalldirs) $(DESTDIR)$(manroot)
172 -test -d $(DESTDIR)$(man1dir) || $(mkinstalldirs) $(DESTDIR)$(man1dir)
174 for p in $$pages; do \
175 prog=`basename $$p .n`; \
176 target=$(DESTDIR)$(man1dir)/$(NAMEPREFIX)$$prog.$(man1ext); \
178 echo $(INSTALL_DATA) $$p $$target; \
179 $(INSTALL_DATA) $$p $$target; \
181 -test -d $(DESTDIR)$(man5dir) || $(mkinstalldirs) $(DESTDIR)$(man5dir)
183 for p in $$pages; do \
184 target=$(DESTDIR)$(man5dir)/`basename $$p .n`.$(man5ext); \
186 echo $(INSTALL_DATA) $$p $$target; \
187 $(INSTALL_DATA) $$p $$target; \
189 -test -d $(DESTDIR)$(man7dir) || $(mkinstalldirs) $(DESTDIR)$(man7dir)
191 for p in $$pages; do \
192 target=$(DESTDIR)$(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=$(DESTDIR)$(man1dir)/$(NAMEPREFIX); \
203 target=$$target`basename $$p .n`.$(man1ext); \
204 echo rm -f $$target; \
208 for p in $$pages; do \
209 target=$(DESTDIR)$(man5dir)/`basename $$p .n`.$(man5ext); \
210 echo rm -f $$target; \
214 for p in $$pages; do \
215 target=$(DESTDIR)$(man7dir)/`basename $$p .n`.$(man7ext); \
216 echo rm -f $$target; \
222 -test -d $(DESTDIR)$(bindir) || $(mkinstalldirs) $(DESTDIR)$(bindir)
223 rm -f $(DESTDIR)$(bindir)/$(NAMEPREFIX)$(PROG)
224 $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(bindir)/$(NAMEPREFIX)$(PROG)
226 .PHONY: uninstall_prog
228 rm -f $(DESTDIR)$(bindir)/$(NAMEPREFIX)$(PROG)
232 -test -d $(DESTDIR)$(datadir) \
233 || $(mkinstalldirs) $(DESTDIR)$(datadir)
234 -test -d $(DESTDIR)$(dataprogramdir) \
235 || $(mkinstalldirs) $(DESTDIR)$(dataprogramdir)
236 -test -d $(DESTDIR)$(datasubdir) \
237 || $(mkinstalldirs) $(DESTDIR)$(datasubdir)
238 -test -d $(DESTDIR)$(fontdir) \
239 || $(mkinstalldirs) $(DESTDIR)$(fontdir)
240 -test -d $(DESTDIR)$(fontsubdir) \
241 || $(mkinstalldirs) $(DESTDIR)$(fontsubdir)
242 -if test -d $(srcdir)/generate; then \
243 test -d $(DESTDIR)$(fontsubdir)/generate \
244 || $(mkinstalldirs) $(DESTDIR)$(fontsubdir)/generate; \
246 -if test -d $(srcdir)/enc; then \
247 test -d $(DESTDIR)$(fontsubdir)/enc \
248 || $(mkinstalldirs) $(DESTDIR)$(fontsubdir)/enc; \
250 -if test -d $(srcdir)/map; then \
251 test -d $(DESTDIR)$(fontsubdir)/map \
252 || $(mkinstalldirs) $(DESTDIR)$(fontsubdir)/map; \
254 -if test -d $(srcdir)/util; then \
255 test -d $(DESTDIR)$(fontsubdir)/util \
256 || $(mkinstalldirs) $(DESTDIR)$(fontsubdir)/util; \
258 -if test -d $(srcdir)/old; then \
259 test -d $(DESTDIR)$(oldfontdir) \
260 || $(mkinstalldirs) $(DESTDIR)$(oldfontdir); \
261 test -d $(DESTDIR)$(oldfontsubdir) \
262 || $(mkinstalldirs) $(DESTDIR)$(oldfontsubdir); \
264 -test -z "$(DEVFILES)" \
265 || for f in ""$(DEVFILES); do \
266 rm -f $(DESTDIR)$(fontsubdir)/$$f; \
267 if test -f $$f; then \
268 $(INSTALL_DATA) $$f $(DESTDIR)$(fontsubdir)/$$f; \
270 $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(fontsubdir)/$$f; \
273 -test -z "$(OLDDEVFILES)" \
274 || for f in ""$(OLDDEVFILES); do \
275 rm -f $(DESTDIR)$(oldfontsubdir)/$$f; \
276 $(INSTALL_DATA) $(srcdir)/old/$$f \
277 $(DESTDIR)$(oldfontsubdir)/$$f; \
279 -test -z "$(DEVSCRIPTS)" \
280 || for f in ""$(DEVSCRIPTS); do \
281 rm -f $(DESTDIR)$(fontsubdir)/$$f; \
282 if test -f $$f; then \
283 $(INSTALL_SCRIPT) $$f $(DESTDIR)$(fontsubdir)/$$f; \
285 $(INSTALL_SCRIPT) $(srcdir)/$$f $(DESTDIR)$(fontsubdir)/$$f; \
289 .PHONY: uninstall_dev
291 -test -z "$(DEVFILES)$(DEVSCRIPTS)" \
292 || for f in ""$(DEVFILES) $(DEVSCRIPTS); do \
293 rm -f $(DESTDIR)$(fontsubdir)/$$f; \
295 -test -z "$(OLDDEVFILES)" \
296 || for f in ""$(OLDDEVFILES); do \
297 rm -f $(DESTDIR)$(oldfontsubdir)/$$f; \
299 -d=$(DESTDIR)$(fontsubdir)/generate;\
300 if test -d $$d; then rmdir $$d; fi
301 -d=$(DESTDIR)$(fontsubdir)/enc;\
302 if test -d $$d; then rmdir $$d; fi
303 -d=$(DESTDIR)$(fontsubdir)/map;\
304 if test -d $$d; then rmdir $$d; fi
305 -d=$(DESTDIR)$(fontsubdir)/util;\
306 if test -d $$d; then rmdir $$d; fi
307 -test -d $(DESTDIR)$(fontsubdir) $$ \
308 rmdir $(DESTDIR)$(fontsubdir)
309 -d=$(DESTDIR)$(oldfontsubdir);\
310 if test -d $$d; then rmdir $$d; fi
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 \
327 || $(CC) $(ALL_CFLAGS) $(EXTRA_CFLAGS) -MM $(CSRCS) >>depend.temp
329 || (sed -e 's|$(YTABH)|$(YTABC)|g' depend.temp >depend1.temp; \
330 mv depend1.temp depend.temp)
334 $(ETAGS) $(ETAGSFLAGS) $(CCSRCS) $(CSRCS)
335 test -z "$(GRAM)$(HDRS)" \
336 || $(ETAGS) $(ETAGSFLAGS) -a $(ETAGSCCFLAG) $(GRAM) $(HDRS)
338 # 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
348 ########################################################################
350 ########################################################################