Don't produce HTML files if utility programs are missing.
[s-roff.git] / Makefile.comm
blobc86aa4c0bbeee9e2fe4634941f2a4fa905e91e20
1 # Copyright (C) 1989-2000, 2002 Free Software Foundation, Inc.
2 #      Written by James Clark (jjc@jclark.com)
3
4 # This file is part of groff.
5
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
9 # version.
10
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
14 # for more details.
15
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.
20 # Makefile.comm
22 SHELL=/bin/sh
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.cc=$(CCC) $(ALL_CCFLAGS) -c
27 ALL_CFLAGS=$(INCLUDES) $(CDEFINES) $(CFLAGS) $(CPPFLAGS)
28 COMPILE.c=$(CC) $(ALL_CFLAGS) -c
29 LINK.cc=$(CCC) $(CCFLAGS) $(LDFLAGS)
30 LINK.c=$(CC) $(CFLAGS) $(LDFLAGS)
31 LIBGROFF=$(top_builddir)/src/libs/libgroff/libgroff.a
32 LIBBIB=$(top_builddir)/src/libs/libbib/libbib.a
33 LIBDRIVER=$(top_builddir)/src/libs/libdriver/libdriver.a
34 MLIB=
35 XLIBS=
36 YTABH=
37 YTABC=
38 GRAM=
39 LIBCLEAN=
40 CLEANADD=
41 CLEANDIRADD=
42 CLEANNOTSRCDIRADD=
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)
48 NAMEPREFIX=
49 HDRS=
50 MANPAGES=$(MAN1) $(MAN5) $(MAN7)
51 MANCLEAN=$(MANPAGES)
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
58 pure:
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
63 .PHONY: pure
65 prefix_must_exist:
66         @test -d $(prefix) \
67           || (echo ; \
68               echo The prefix directory \`$(prefix)\' doesn\'t exist; \
69               echo ; \
70               exit 1)
72 mostlyclean:
73         -rm -f $(MOSTLYCLEANFILES)
74         -rm -rf $(CLEANDIRADD)
75         -@if test `cd $(srcdir); pwd` = `pwd`; then \
76           :; \
77         else \
78           rm -f $(CLEANNOTSRCDIRADD); \
79         fi
81 clean: mostlyclean
82         -rm -f $(CLEANFILES)
84 distclean: clean
85         -rm -f $(DISTCLEANFILES)
86         -@if test `cd $(srcdir); pwd` = `pwd`; then \
87           :; \
88         else \
89           rm -f $(YTABC) $(YTABH); \
90         fi
92 realclean: distclean
93         -rm -f $(REALCLEANFILES)
95 extraclean: distclean
96         -rm -f \#* *~ =* core junk grot old temp tmp tem
98 .SUFFIXES:
99 .SUFFIXES: .o .cc .c .y .man .n
101 .cc.o:
102         $(COMPILE.cc) $<
104 .c.o:
105         $(COMPILE.c) $<
107 .y.cc:
108         if test -n "$(YTABH)"; then \
109           $(YACC) $(YACCFLAGS) -d $<; \
110         else \
111           $(YACC) $(YACCFLAGS) $<; \
112         fi
113         -test -f y.tab.h && mv y.tab.h y_tab.h
114         -test -f y.tab.c && mv y.tab.c y_tab.c
115         mv y_tab.c $(YTABC)
116         if test -n "$(YTABH)"; then mv y_tab.h $(YTABH); fi
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.cc rule above).
120 .y.o:
121         if test -n "$(YTABH)"; then \
122           $(YACC) $(YACCFLAGS) -d $<; \
123         else \
124           $(YACC) $(YACCFLAGS) $<; \
125         fi
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
128         mv y_tab.c $(YTABC)
129         if test -n "$(YTABH)"; then mv y_tab.h $(YTABH); fi
130         $(COMPILE.cc) $(YTABC)
132 .man.n:
133         @echo Making $@ from $<
134         @-rm -f $@
135         @sed -e "s|@BINDIR@|$(bindir)|g" \
136         -e "s|@FONTDIR@|$(fontdir)|g" \
137         -e "s|@FONTPATH@|$(fontpath)|g" \
138         -e "s|@MACRODIR@|$(tmacdir)|g" \
139         -e "s|@SYSTEMMACRODIR@|$(systemtmacdir)|g" \
140         -e "s|@LOCALMACRODIR@|$(localtmacdir)|g" \
141         -e "s|@MACROPATH@|$(tmacpath)|g" \
142         -e "s|@DOCDIR@|$(docdir)|g" \
143         -e "s|@EXAMPLEDIR@|$(exampledir)|g" \
144         -e "s|@HTMLDOCDIR@|$(htmldocdir)|g" \
145         -e "s|@DEVICE@|$(DEVICE)|g" \
146         -e "s|@DEFAULT_INDEX@|$(indexdir)/$(indexname)|g" \
147         -e "s|@DEFAULT_INDEX_NAME@|$(indexname)|g" \
148         -e "s|@INDEX_SUFFIX@|$(indexext)|g" \
149         -e "s|@COMMON_WORDS_FILE@|$(common_words_file)|g" \
150         -e "s|@MAN1EXT@|$(man1ext)|g" \
151         -e "s|@MAN5EXT@|$(man5ext)|g" \
152         -e "s|@MAN7EXT@|$(man7ext)|g" \
153         -e "s|@TMAC_S_PREFIX@|$(tmac_s_prefix)|g" \
154         -e "s|@TMAC_M_PREFIX@|$(tmac_m_prefix)|g" \
155         -e "s|@TMAC_AN_PREFIX@|$(tmac_an_prefix)|g" \
156         -e "s|@TMAC_MDIR@|$(tmacdir)/mm|g" \
157         -e "s|@BROKEN_SPOOLER_FLAGS@|$(BROKEN_SPOOLER_FLAGS)|g" \
158         -e "s|@VERSION@|$(version)$(revision)|g" \
159         -e "s|@MDATE@|`$(SHELL) $(top_srcdir)/mdate.sh $<`|g" \
160         -e "s|@g@|$(g)|g" \
161         -e "s!@G@!`echo $(g) | tr [a-z] [A-Z]`!g" \
162         $< >$@
164 .PHONY: install_man
165 install_man:
166         -test -d $(manroot) || $(mkinstalldirs) $(manroot)
167         -test -d $(man1dir) || $(mkinstalldirs) $(man1dir)
168         @-pages="$(MAN1)"; \
169         for p in $$pages; do \
170          prog=`basename $$p .n`; \
171          target=$(man1dir)/$(NAMEPREFIX)$$prog.$(man1ext); \
172          rm -f $$target; \
173          echo $(INSTALL_DATA) $$p $$target; \
174          $(INSTALL_DATA) $$p $$target; \
175         done
176         -test -d $(man5dir) || $(mkinstalldirs) $(man5dir)
177         @-pages="$(MAN5)"; \
178         for p in $$pages; do \
179          target=$(man5dir)/`basename $$p .n`.$(man5ext); \
180          rm -f $$target; \
181          echo $(INSTALL_DATA) $$p $$target; \
182          $(INSTALL_DATA) $$p $$target; \
183         done
184         -test -d $(man7dir) || $(mkinstalldirs) $(man7dir)
185         @-pages="$(MAN7)"; \
186         for p in $$pages; do \
187          target=$(man7dir)/`basename $$p .n`.$(man7ext); \
188          rm -f $$target; \
189          echo $(INSTALL_DATA) $$p $$target; \
190          $(INSTALL_DATA) $$p $$target; \
191         done
193 .PHONY: uninstall_man
194 uninstall_man:
195         @-pages="$(MAN1)"; \
196         for p in $$pages; do \
197          target=$(man1dir)/$(NAMEPREFIX)`basename $$p .n`.$(man1ext); \
198          echo rm -f $$target; \
199          rm -f $$target; \
200         done
201         @-pages="$(MAN5)"; \
202         for p in $$pages; do \
203          target=$(man5dir)/`basename $$p .n`.$(man5ext); \
204          echo rm -f $$target; \
205          rm -f $$target; \
206         done
207         @-pages="$(MAN7)"; \
208         for p in $$pages; do \
209          target=$(man7dir)/`basename $$p .n`.$(man7ext); \
210          echo rm -f $$target; \
211          rm -f $$target; \
212         done
214 .PHONY: install_prog
215 install_prog:
216         -test -d $(bindir) || $(mkinstalldirs) $(bindir)
217         rm -f $(bindir)/$(NAMEPREFIX)$(PROG)
218         $(INSTALL_PROGRAM) $(PROG) $(bindir)/$(NAMEPREFIX)$(PROG)
220 .PHONY: uninstall_prog
221 uninstall_prog:
222         -rm -f $(bindir)/$(NAMEPREFIX)$(PROG)   
224 .PHONY: install_dev
225 install_dev:
226         -test -d $(datadir) || $(mkinstalldirs) $(datadir)
227         -test -d $(dataprogramdir) || $(mkinstalldirs) $(dataprogramdir)
228         -test -d $(datasubdir) || $(mkinstalldirs) $(datasubdir)
229         -test -d $(fontdir) || $(mkinstalldirs) $(fontdir)
230         -test -d $(fontsubdir) || $(mkinstalldirs) $(fontsubdir)
231         -if test -d $(srcdir)/generate; then \
232           test -d $(fontsubdir)/generate || \
233             $(mkinstalldirs) $(fontsubdir)/generate; \
234         fi
235         -for f in $(DEVFILES); do \
236           rm -f $(fontsubdir)/$$f; \
237           if test -f $$f; then \
238             $(INSTALL_DATA) $$f $(fontsubdir)/$$f; \
239           else \
240             $(INSTALL_DATA) $(srcdir)/$$f $(fontsubdir)/$$f; \
241           fi; \
242         done
244 .PHONY: uninstall_dev
245 uninstall_dev:
246         -for f in $(DEVFILES); do rm -f $(fontsubdir)/$$f; done
247         -if test -d $(fontsubdir)/generate; then \
248           rmdir $(fontsubdir)/generate; \
249         fi
250         -rmdir $(fontsubdir)
252 .PHONY: depend_src
253 depend_src: depend.temp
254         mv depend.temp Makefile.dep
256 depend.temp: FORCE
257         > depend.temp;
258         test -z "$(CCSRCS)$(YTABC)" \
259           || $(CCC) $(ALL_CCFLAGS) -MM $(CCSRCS) $(YTABC) >>depend.temp
260         test -z "$(CSRCS)" \
261           || $(CC) $(ALL_CFLAGS) -MM $(CSRCS) >>depend.temp
262         if test -n "$(YTABH)"; then \
263           sed -e 's|$(YTABH)|$(YTABC)|g' depend.temp >depend1.temp; \
264           mv depend1.temp depend.temp; \
265         fi
267 .PHONY: TAGS_src
268 TAGS_src:
269         $(ETAGS) $(ETAGSFLAGS) $(CCSRCS) $(CSRCS)
270         test -z "$(GRAM)$(HDRS)" \
271           || $(ETAGS) $(ETAGSFLAGS) -a $(ETAGSCCFLAG) $(GRAM) $(HDRS)
273 # This rule is only considered for the subdir_Makefile target.
274 Makefile:
275         -rm -f Makefile
276         echo srcdir=$(srcdir) >>Makefile
277         echo VPATH=$(VPATH) >>Makefile
278         cat $(MAKEFILEPARTS) /dev/null >>Makefile
280 FORCE:
282 .NOEXPORT: