groff before CVS: release 1.06
[s-roff.git] / Makefile.comm
blob58234b32a3e2315f7aea36d4bbe6c4a7e9cb3d96
1 # Copyright (C) 1989, 1990, 1991, 1992 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, 675 Mass Ave, Cambridge, MA 02139, USA.
20 # Makefile.comm
22 SHELL=/bin/sh
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)
30 TOP=..
31 LIBGROFF=$(TOP)/libgroff/libgroff.a
32 LIBBIB=$(TOP)/libbib/libbib.a
33 LIBDRIVER=$(TOP)/libdriver/libdriver.a
34 LIBM=-lm
35 MLIB=
36 XLIBS=
37 YTABH=
38 YTABC=
39 GRAM=
40 LIBCLEAN=
41 CLEANADD=
42 MOSTLYCLEANFILES=$(MANCLEAN) $(PROG) $(OBJS) $(GENSRCS) $(GENHDRS) \
43   depend.temp core $(CLEANADD)
44 CLEANFILES=$(LIBCLEAN)
45 DISTCLEANFILES=TAGS Makefile
46 REALCLEANFILES=$(YTABC) $(YTABH) Makefile.dep
47 NAMEPREFIX=
48 HDRS=
49 MANPAGES=$(MAN1) $(MAN5) $(MAN7)
50 MANCLEAN=$(MANPAGES)
51 fontsubdir=$(fontdir)/dev$(DEV)
53 all install install_bin install_data TAGS depend distfiles:
55 install: install_bin install_data
57 .PHONY: all clean distclean mostlyclean realclean extraclean depend distfiles
58 .PHONY: install install_bin install_data
60 mostlyclean:
61         -rm -f $(MOSTLYCLEANFILES)
63 clean:
64         -rm -f $(CLEANFILES) $(MOSTLYCLEANFILES)
66 distclean:
67         -rm -f $(DISTCLEANFILES) $(CLEANFILES) $(MOSTLYCLEANFILES)
69 realclean:
70         -rm -f $(REALCLEANFILES) $(DISTCLEANFILES) $(CLEANFILES) \
71           $(MOSTLYCLEANFILES)
73 extraclean:
74         -rm -f $(DISTCLEANFILES) $(CLEANFILES) $(MOSTLYCLEANFILES) \
75           \#* *~ core junk grot old temp tmp tem
77 .SUFFIXES:
78 .SUFFIXES: .o .cc .c .y .man .n
80 .cc.o:
81         $(COMPILE.cc) $<
83 .c.o:
84         $(COMPILE.c) $<
86 .y.cc:
87         if test -n "$(YTABH)"; then \
88           $(YACC) $(YACCFLAGS) -d $<; \
89         else \
90           $(YACC) $(YACCFLAGS) $<; \
91         fi
92         mv y.tab.c $@
93         test -z "$(YTABH)" || mv y.tab.h $(YTABH)
95 .man.n:
96         @echo Making $@ from $<
97         @-rm -f $@
98         @sed -e "s;@HYPHENFILE@;$(hyphenfile);g" \
99         -e "s;@FONTDIR@;$(fontdir);g" \
100         -e "s;@FONTPATH@;$(fontpath);g" \
101         -e "s;@MACRODIR@;$(tmacdir);g" \
102         -e "s;@MACROPATH@;$(tmacpath);g" \
103         -e "s;@DEVICE@;$(DEVICE);g" \
104         -e "s;@DEFAULT_INDEX@;$(indexdir)/$(indexname);g" \
105         -e "s;@DEFAULT_INDEX_NAME@;$(indexname);g" \
106         -e "s;@INDEX_SUFFIX@;$(indexext);g" \
107         -e "s;@COMMON_WORDS_FILE@;$(common_words_file);g" \
108         -e "s;@MAN1EXT@;$(man1ext);g" \
109         -e "s;@MAN5EXT@;$(man5ext);g" \
110         -e "s;@MAN7EXT@;$(man7ext);g" \
111         -e "s;@TMAC_S@;$(tmac_s);g" \
112         -e "s;@TMAC_M@;$(tmac_m);g" \
113         -e "s;@TMAC_MDIR@;$(macrodir)/mm;g" \
114         -e "s;@BROKEN_SPOOLER_FLAGS@;$(BROKEN_SPOOLER_FLAGS);g" \
115         -e "s;@VERSION@;`cat $(srcdir)/../VERSION`;g" \
116         -e "s;@MDATE@;`$(SHELL) $(srcdir)/../mdate.sh $<`;g" \
117         -e "s;@g@;$(g);g" \
118         -e "s;@G@;`echo $(g) | tr [a-z] [A-Z]`;g" \
119         $< >$@
121 .PHONY: install_man
122 install_man:
123         -test -d $(manroot) || mkdir $(manroot)
124         -test -d $(man1dir) || mkdir $(man1dir)
125         @-pages="$(MAN1)"; \
126         for p in $$pages; do \
127          prog=`basename $$p .n`; \
128          target=$(man1dir)/$(NAMEPREFIX)$$prog.$(man1ext); \
129          rm -f $$target; \
130          echo $(INSTALL_DATA) $$p $$target; \
131          $(INSTALL_DATA) $$p $$target; \
132         done
133         -test -d $(man5dir) || mkdir $(man5dir)
134         @-pages="$(MAN5)"; \
135         for p in $$pages; do \
136          target=$(man5dir)/`basename $$p .n`.$(man5ext); \
137          rm -f $$target; \
138          echo $(INSTALL_DATA) $$p $$target; \
139          $(INSTALL_DATA) $$p $$target; \
140         done
141         -test -d $(man7dir) || mkdir $(man7dir)
142         @-pages="$(MAN7)"; \
143         for p in $$pages; do \
144          target=$(man7dir)/`basename $$p .n`.$(man7ext); \
145          rm -f $$target; \
146          echo $(INSTALL_DATA) $$p $$target; \
147          $(INSTALL_DATA) $$p $$target; \
148         done
150 .PHONY: install_prog
151 install_prog:
152         -test -d $(bindir) || mkdir $(bindir)
153         rm -f $(bindir)/$(NAMEPREFIX)$(PROG)
154         $(INSTALL_PROGRAM) $(PROG) $(bindir)/$(NAMEPREFIX)$(PROG)
156 .PHONY: install_dev
157 install_dev:
158         -test -d $(datadir) || mkdir $(datadir)
159         -test -d $(datasubdir) || mkdir $(datasubdir)
160         -test -d $(fontdir) || mkdir $(fontdir)
161         -test -d $(fontsubdir) || mkdir $(fontsubdir)
162         -if test -d $(srcdir)/generate; then \
163           test -d $(fontsubdir)/generate || mkdir $(fontsubdir)/generate; \
164         fi
165         -for f in $(DEVFILES); do \
166           rm -f $(fontsubdir)/$$f; \
167           if test -f $$f; then \
168             $(INSTALL_DATA) $$f $(fontsubdir)/$$f; \
169           else \
170             $(INSTALL_DATA) $(srcdir)/$$f $(fontsubdir)/$$f; \
171           fi; \
172         done
174 .PHONY: depend_src
175 depend_src: depend.temp
176         mv depend.temp Makefile.dep
178 depend.temp: FORCE
179         > depend.temp;
180         test -z "$(CCSRCS)$(YTABC)"  \
181           || $(CCC) $(ALL_CCFLAGS) -MM $(CCSRCS) $(YTABC) >>depend.temp
182         test -z "$(CSRCS)" \
183           || $(CC) $(ALL_CFLAGS) -MM $(CSRCS) >>depend.temp
184         if test -n "$(YTABH)"; then \
185           sed -e 's|$(YTABH)|$(YTABC)|g' depend.temp >depend.temp1; \
186           mv depend.temp1 depend.temp; \
187         fi
189 .PHONY: TAGS_src
190 TAGS_src:
191         $(ETAGS) $(ETAGSFLAGS) $(CCSRCS) $(CSRCS)
192         test -z "$(GRAM)$(HDRS)" \
193           || $(ETAGS) $(ETAGSFLAGS) -a $(ETAGSCCFLAG) $(GRAM) $(HDRS)
195 Makefile:
196         -rm -f Makefile
197         echo srcdir=$(srcdir) >>Makefile
198         echo VPATH=$(VPATH) >>Makefile
199         cat $(MAKEFILEPARTS) /dev/null >>Makefile
201 FORCE:
203 .NOEXPORT: