1 # Copyright (C) 1989-2000 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.
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=$(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
41 MOSTLYCLEANFILES=$(MANCLEAN) $(PROG) $(OBJS) $(GENSRCS) $(GENHDRS) \
42 depend.temp core y.output $(CLEANADD)
43 CLEANFILES=$(LIBCLEAN)
44 DISTCLEANFILES=TAGS Makefile Makefile.dep
45 REALCLEANFILES=$(YTABC) $(YTABH)
48 MANPAGES=$(MAN1) $(MAN5) $(MAN7)
50 fontsubdir=$(fontdir)/dev$(DEV)
52 all install install_bin install_data TAGS depend distfiles uninstall_sub:
54 install: prefix_must_exist install_bin install_data
55 uninstall: uninstall_sub
58 .PHONY: all clean distclean mostlyclean realclean extraclean depend distfiles
59 .PHONY: install install_bin install_data prefix_must_exist
60 .PHONY: uninstall uninstall_sub
66 echo The prefix directory \`$(prefix)\' doesn\'t exist; \
71 -rm -f $(MOSTLYCLEANFILES)
74 -rm -f $(CLEANFILES) $(MOSTLYCLEANFILES)
77 -rm -f $(DISTCLEANFILES) $(CLEANFILES) $(MOSTLYCLEANFILES)
80 -rm -f $(REALCLEANFILES) $(DISTCLEANFILES) $(CLEANFILES) \
84 -rm -f $(DISTCLEANFILES) $(CLEANFILES) $(MOSTLYCLEANFILES) \
85 \#* *~ =* core junk grot old temp tmp tem
88 .SUFFIXES: .o .cc .c .y .man .n
97 if test -n "$(YTABH)"; then \
98 $(YACC) $(YACCFLAGS) -d $<; \
100 $(YACC) $(YACCFLAGS) $<; \
103 # Avoid ending up with two versions of $(YTABH).
104 if test -n "$(YTABH)"; then \
105 if test -f $(srcdir)/$(YTABH); then \
107 mv y.tab.h $(srcdir)/$(YTABH); \
109 mv y.tab.h $(YTABH); \
113 version=`cat $(top_srcdir)/VERSION`
114 # No additional number for the groff archive if revision is zero
115 revision=`sed -e 's/^0$$//' -e 's/^[1-9].*$$/.&/' $(top_srcdir)/REVISION`
118 @echo Making $@ from $<
120 @sed -e "s;@FONTDIR@;$(fontdir);g" \
121 -e "s;@FONTPATH@;$(fontpath);g" \
122 -e "s;@MACRODIR@;$(tmacdir);g" \
123 -e "s;@MACROPATH@;$(tmacpath);g" \
124 -e "s;@DEVICE@;$(DEVICE);g" \
125 -e "s;@DEFAULT_INDEX@;$(indexdir)/$(indexname);g" \
126 -e "s;@DEFAULT_INDEX_NAME@;$(indexname);g" \
127 -e "s;@INDEX_SUFFIX@;$(indexext);g" \
128 -e "s;@COMMON_WORDS_FILE@;$(common_words_file);g" \
129 -e "s;@MAN1EXT@;$(man1ext);g" \
130 -e "s;@MAN5EXT@;$(man5ext);g" \
131 -e "s;@MAN7EXT@;$(man7ext);g" \
132 -e "s;@TMAC_S_PREFIX@;$(tmac_s_prefix);g" \
133 -e "s;@TMAC_M_PREFIX@;$(tmac_m_prefix);g" \
134 -e "s;@TMAC_AN_PREFIX@;$(tmac_an_prefix);g" \
135 -e "s;@TMAC_MDIR@;$(tmacdir)/mm;g" \
136 -e "s;@BROKEN_SPOOLER_FLAGS@;$(BROKEN_SPOOLER_FLAGS);g" \
137 -e "s;@VERSION@;$(version)$(revision);g" \
138 -e "s;@MDATE@;`$(SHELL) $(top_srcdir)/mdate.sh $<`;g" \
140 -e "s;@G@;`echo $(g) | tr [a-z] [A-Z]`;g" \
145 -test -d $(manroot) || $(mkinstalldirs) $(manroot)
146 -test -d $(man1dir) || $(mkinstalldirs) $(man1dir)
148 for p in $$pages; do \
149 prog=`basename $$p .n`; \
150 target=$(man1dir)/$(NAMEPREFIX)$$prog.$(man1ext); \
152 echo $(INSTALL_DATA) $$p $$target; \
153 $(INSTALL_DATA) $$p $$target; \
155 -test -d $(man5dir) || $(mkinstalldirs) $(man5dir)
157 for p in $$pages; do \
158 target=$(man5dir)/`basename $$p .n`.$(man5ext); \
160 echo $(INSTALL_DATA) $$p $$target; \
161 $(INSTALL_DATA) $$p $$target; \
163 -test -d $(man7dir) || $(mkinstalldirs) $(man7dir)
165 for p in $$pages; do \
166 target=$(man7dir)/`basename $$p .n`.$(man7ext); \
168 echo $(INSTALL_DATA) $$p $$target; \
169 $(INSTALL_DATA) $$p $$target; \
172 .PHONY: uninstall_man
175 for p in $$pages; do \
176 target=$(man1dir)/$(NAMEPREFIX)`basename $$p .n`.$(man1ext); \
177 echo rm -f $$target; \
181 for p in $$pages; do \
182 target=$(man5dir)/`basename $$p .n`.$(man5ext); \
183 echo rm -f $$target; \
187 for p in $$pages; do \
188 target=$(man7dir)/`basename $$p .n`.$(man7ext); \
189 echo rm -f $$target; \
195 -test -d $(bindir) || $(mkinstalldirs) $(bindir)
196 rm -f $(bindir)/$(NAMEPREFIX)$(PROG)
197 $(INSTALL_PROGRAM) $(PROG) $(bindir)/$(NAMEPREFIX)$(PROG)
199 .PHONY: uninstall_prog
201 -rm -f $(bindir)/$(NAMEPREFIX)$(PROG)
205 -test -d $(datadir) || $(mkinstalldirs) $(datadir)
206 -test -d $(datasubdir) || $(mkinstalldirs) $(datasubdir)
207 -test -d $(fontdir) || $(mkinstalldirs) $(fontdir)
208 -test -d $(fontsubdir) || $(mkinstalldirs) $(fontsubdir)
209 -if test -d $(srcdir)/generate; then \
210 test -d $(fontsubdir)/generate || \
211 $(mkinstalldirs) $(fontsubdir)/generate; \
213 -for f in $(DEVFILES); do \
214 rm -f $(fontsubdir)/$$f; \
215 if test -f $$f; then \
216 $(INSTALL_DATA) $$f $(fontsubdir)/$$f; \
218 $(INSTALL_DATA) $(srcdir)/$$f $(fontsubdir)/$$f; \
222 .PHONY: uninstall_dev
224 -for f in $(DEVFILES); do rm -f $(fontsubdir)/$$f; done
225 -if test -d $(fontsubdir)/generate; then \
226 rmdir $(fontsubdir)/generate; \
231 depend_src: depend.temp
232 mv depend.temp Makefile.dep
236 test -z "$(CCSRCS)$(YTABC)" \
237 || $(CCC) $(ALL_CCFLAGS) -MM $(CCSRCS) $(YTABC) >>depend.temp
239 || $(CC) $(ALL_CFLAGS) -MM $(CSRCS) >>depend.temp
240 if test -n "$(YTABH)"; then \
241 sed -e 's|$(YTABH)|$(YTABC)|g' depend.temp >depend.temp1; \
242 mv depend.temp1 depend.temp; \
247 $(ETAGS) $(ETAGSFLAGS) $(CCSRCS) $(CSRCS)
248 test -z "$(GRAM)$(HDRS)" \
249 || $(ETAGS) $(ETAGSFLAGS) -a $(ETAGSCCFLAG) $(GRAM) $(HDRS)
253 echo srcdir=$(srcdir) >>Makefile
254 echo VPATH=$(VPATH) >>Makefile
255 cat $(MAKEFILEPARTS) /dev/null >>Makefile