1 # Copyright (C) 1989, 1990, 1991, 1992 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) -I../include -I$(srcdir)/../include
24 ALL_CCFLAGS=$(INCLUDES) $(CCDEFINES) $(CCFLAGS) $(CPPFLAGS)
25 COMPILE.cc=$(CCC) $(ALL_CCFLAGS) -c
26 ALL_CFLAGS=$(CDEFINES) $(CFLAGS) $(CPPFLAGS)
27 COMPILE.c=$(CC) $(ALL_CFLAGS) -c
28 LINK.cc=$(CCC) $(CCFLAGS) $(LDFLAGS)
29 LINK.c=$(CC) $(CFLAGS) $(LDFLAGS)
31 LIBGROFF=$(TOP)/libgroff/libgroff.a
32 LIBBIB=$(TOP)/libbib/libbib.a
33 LIBDRIVER=$(TOP)/libdriver/libdriver.a
42 MOSTLYCLEANFILES=$(MANCLEAN) $(PROG) $(OBJS) $(GENSRCS) $(GENHDRS) \
43 depend.temp core y.output $(CLEANADD)
44 CLEANFILES=$(LIBCLEAN)
45 DISTCLEANFILES=TAGS Makefile
46 REALCLEANFILES=$(YTABC) $(YTABH)
49 MANPAGES=$(MAN1) $(MAN5) $(MAN7)
51 fontsubdir=$(fontdir)/dev$(DEV)
53 all install install_bin install_data TAGS depend distfiles uninstall_sub:
55 install: install_bin install_data
56 uninstall: uninstall_sub
59 .PHONY: all clean distclean mostlyclean realclean extraclean depend distfiles
60 .PHONY: install install_bin install_data
61 .PHONY: uninstall uninstall_sub
65 -rm -f $(MOSTLYCLEANFILES)
68 -rm -f $(CLEANFILES) $(MOSTLYCLEANFILES)
71 -rm -f $(DISTCLEANFILES) $(CLEANFILES) $(MOSTLYCLEANFILES)
74 -rm -f $(REALCLEANFILES) $(DISTCLEANFILES) $(CLEANFILES) \
78 -rm -f $(DISTCLEANFILES) $(CLEANFILES) $(MOSTLYCLEANFILES) \
79 \#* *~ =* core junk grot old temp tmp tem
82 .SUFFIXES: .o .cc .c .y .man .n
91 if test -n "$(YTABH)"; then \
92 $(YACC) $(YACCFLAGS) -d $<; \
94 $(YACC) $(YACCFLAGS) $<; \
97 # Avoid ending up with two versions of $(YTABH).
98 if test -n "$(YTABH)"; then \
99 if test -f $(srcdir)/$(YTABH); then \
101 mv y.tab.h $(srcdir)/$(YTABH); \
103 mv y.tab.h $(YTABH); \
108 @echo Making $@ from $<
110 @sed -e "s;@FONTDIR@;$(fontdir);g" \
111 -e "s;@FONTPATH@;$(fontpath);g" \
112 -e "s;@MACRODIR@;$(tmacdir);g" \
113 -e "s;@MACROPATH@;$(tmacpath);g" \
114 -e "s;@DEVICE@;$(DEVICE);g" \
115 -e "s;@DEFAULT_INDEX@;$(indexdir)/$(indexname);g" \
116 -e "s;@DEFAULT_INDEX_NAME@;$(indexname);g" \
117 -e "s;@INDEX_SUFFIX@;$(indexext);g" \
118 -e "s;@COMMON_WORDS_FILE@;$(common_words_file);g" \
119 -e "s;@MAN1EXT@;$(man1ext);g" \
120 -e "s;@MAN5EXT@;$(man5ext);g" \
121 -e "s;@MAN7EXT@;$(man7ext);g" \
122 -e "s;@TMAC_S_PREFIX@;$(tmac_s_prefix);g" \
123 -e "s;@TMAC_M_PREFIX@;$(tmac_m_prefix);g" \
124 -e "s;@TMAC_MDIR@;$(tmacdir)/mm;g" \
125 -e "s;@BROKEN_SPOOLER_FLAGS@;$(BROKEN_SPOOLER_FLAGS);g" \
126 -e "s;@VERSION@;`cat $(srcdir)/../VERSION`;g" \
127 -e "s;@MDATE@;`$(SHELL) $(srcdir)/../mdate.sh $<`;g" \
129 -e "s;@G@;`echo $(g) | tr [a-z] [A-Z]`;g" \
134 -test -d $(manroot) || mkdir $(manroot)
135 -test -d $(man1dir) || mkdir $(man1dir)
137 for p in $$pages; do \
138 prog=`basename $$p .n`; \
139 target=$(man1dir)/$(NAMEPREFIX)$$prog.$(man1ext); \
141 echo $(INSTALL_DATA) $$p $$target; \
142 $(INSTALL_DATA) $$p $$target; \
144 -test -d $(man5dir) || mkdir $(man5dir)
146 for p in $$pages; do \
147 target=$(man5dir)/`basename $$p .n`.$(man5ext); \
149 echo $(INSTALL_DATA) $$p $$target; \
150 $(INSTALL_DATA) $$p $$target; \
152 -test -d $(man7dir) || mkdir $(man7dir)
154 for p in $$pages; do \
155 target=$(man7dir)/`basename $$p .n`.$(man7ext); \
157 echo $(INSTALL_DATA) $$p $$target; \
158 $(INSTALL_DATA) $$p $$target; \
161 .PHONY: uninstall_man
164 for p in $$pages; do \
165 target=$(man1dir)/$(NAMEPREFIX)`basename $$p .n`.$(man1ext); \
166 echo rm -f $$target; \
170 for p in $$pages; do \
171 target=$(man5dir)/`basename $$p .n`.$(man5ext); \
172 echo rm -f $$target; \
176 for p in $$pages; do \
177 target=$(man7dir)/`basename $$p .n`.$(man7ext); \
178 echo rm -f $$target; \
184 -test -d $(bindir) || mkdir $(bindir)
185 rm -f $(bindir)/$(NAMEPREFIX)$(PROG)
186 $(INSTALL_PROGRAM) $(PROG) $(bindir)/$(NAMEPREFIX)$(PROG)
188 .PHONY: uninstall_prog
190 -rm -f $(bindir)/$(NAMEPREFIX)$(PROG)
194 -test -d $(datadir) || mkdir $(datadir)
195 -test -d $(datasubdir) || mkdir $(datasubdir)
196 -test -d $(fontdir) || mkdir $(fontdir)
197 -test -d $(fontsubdir) || mkdir $(fontsubdir)
198 -if test -d $(srcdir)/generate; then \
199 test -d $(fontsubdir)/generate || mkdir $(fontsubdir)/generate; \
201 -for f in $(DEVFILES); do \
202 rm -f $(fontsubdir)/$$f; \
203 if test -f $$f; then \
204 $(INSTALL_DATA) $$f $(fontsubdir)/$$f; \
206 $(INSTALL_DATA) $(srcdir)/$$f $(fontsubdir)/$$f; \
210 .PHONY: uninstall_dev
212 -for f in $(DEVFILES); do rm -f $(fontsubdir)/$$f; done
213 -if test -d $(fontsubdir)/generate; then \
214 rmdir $(fontsubdir)/generate; \
219 depend_src: depend.temp
220 mv depend.temp Makefile.dep
224 test -z "$(CCSRCS)$(YTABC)" \
225 || $(CCC) $(ALL_CCFLAGS) -MM $(CCSRCS) $(YTABC) >>depend.temp
227 || $(CC) $(ALL_CFLAGS) -MM $(CSRCS) >>depend.temp
228 if test -n "$(YTABH)"; then \
229 sed -e 's|$(YTABH)|$(YTABC)|g' depend.temp >depend.temp1; \
230 mv depend.temp1 depend.temp; \
235 $(ETAGS) $(ETAGSFLAGS) $(CCSRCS) $(CSRCS)
236 test -z "$(GRAM)$(HDRS)" \
237 || $(ETAGS) $(ETAGSFLAGS) -a $(ETAGSCCFLAG) $(GRAM) $(HDRS)
241 echo srcdir=$(srcdir) >>Makefile
242 echo VPATH=$(VPATH) >>Makefile
243 cat $(MAKEFILEPARTS) /dev/null >>Makefile