1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-14 10:09:48 +00:00
freebsd/contrib/groff/Makefile.comm
2005-10-20 10:45:19 +00:00

305 lines
8.5 KiB
Makefile

# Copyright (C) 1989-2000, 2002, 2003, 2004 Free Software Foundation, Inc.
# Written by James Clark (jjc@jclark.com)
#
# This file is part of groff.
#
# groff is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2, or (at your option) any later
# version.
#
# groff is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License along
# with groff; see the file COPYING. If not, write to the Free Software
# Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA.
#
# Makefile.comm
#
INCLUDES=-I. -I$(srcdir) \
-I$(top_builddir)/src/include -I$(top_srcdir)/src/include
ALL_CCFLAGS=$(INCLUDES) $(CCDEFINES) $(CCFLAGS) $(CPPFLAGS)
COMPILE.cpp=$(CCC) $(ALL_CCFLAGS) -c
ALL_CFLAGS=$(INCLUDES) $(CDEFINES) $(CFLAGS) $(CPPFLAGS)
COMPILE.c=$(CC) $(ALL_CFLAGS) -c
LINK.cpp=$(CCC) $(CCFLAGS) $(LDFLAGS)
LINK.c=$(CC) $(CFLAGS) $(LDFLAGS)
LIBGROFF=$(top_builddir)/src/libs/libgroff/libgroff.$(LIBEXT)
LIBBIB=$(top_builddir)/src/libs/libbib/libbib.$(LIBEXT)
LIBDRIVER=$(top_builddir)/src/libs/libdriver/libdriver.$(LIBEXT)
LIBXUTIL=$(top_builddir)/src/libs/libxutil/libxutil.$(LIBEXT)
MLIB=
XLIBS=
YTABH=
YTABC=
GRAM=
LIBCLEAN=
CLEANADD=
CLEANDIRADD=
CLEANNOTSRCDIRADD=
MOSTLYCLEANFILES=$(MANCLEAN) $(PROG) $(OBJS) $(GENSRCS) $(GENHDRS) \
depend.temp core y.output $(CLEANADD)
CLEANFILES=$(LIBCLEAN)
DISTCLEANFILES=TAGS Makefile Makefile.dep
REALCLEANFILES=$(YTABC) $(YTABH)
NAMEPREFIX=
HDRS=
MANPAGES=$(MAN1) $(MAN5) $(MAN7)
MANCLEAN=$(MANPAGES)
fontsubdir=$(fontdir)/dev$(DEV)
all install install_bin install_data TAGS depend distfiles uninstall_sub:
install: prefix_must_exist install_bin install_data
uninstall: uninstall_sub
pure:
.PHONY: all clean distclean mostlyclean realclean extraclean depend distfiles
.PHONY: install install_bin install_data prefix_must_exist
.PHONY: uninstall uninstall_sub
.PHONY: pure
prefix_must_exist:
@test -d $(prefix) \
|| (echo ; \
echo The prefix directory \`$(prefix)\' doesn\'t exist; \
echo ; \
exit 1)
mostlyclean:
-rm -f $(MOSTLYCLEANFILES)
-rm -rf $(CLEANDIRADD)
-@if test `cd $(srcdir); pwd` = `pwd`; then \
:; \
else \
rm -f $(CLEANNOTSRCDIRADD); \
fi
clean: mostlyclean
-rm -f $(CLEANFILES)
distclean: clean
-rm -f $(DISTCLEANFILES)
-@if test `cd $(srcdir); pwd` = `pwd`; then \
:; \
else \
rm -f $(YTABC) $(YTABH); \
fi
realclean: distclean
-rm -f $(REALCLEANFILES)
extraclean: distclean
-rm -f \#* *~ =* core junk grot old temp tmp tem *.new *.old *.orig
.SUFFIXES:
.SUFFIXES: .o .obj .cpp .c .y .man .n
.cpp.o:
$(COMPILE.cpp) $(EXTRA_CCFLAGS) $<
.c.o:
$(COMPILE.c) $(EXTRA_CFLAGS) $<
.cpp.obj:
$(COMPILE.cpp) $(EXTRA_CCFLAGS) $<
.c.obj:
$(COMPILE.c) $(EXTRA_CFLAGS) $<
.y.cpp:
if test -n "$(YTABH)"; then \
$(YACC) $(YACCFLAGS) -d $<; \
else \
$(YACC) $(YACCFLAGS) $<; \
fi
-test -f y.tab.h && mv y.tab.h y_tab.h
-test -f y.tab.c && mv y.tab.c y_tab.c
mv y_tab.c $(YTABC)
test -z "$(YTABH)" || mv y_tab.h $(YTABH)
# The next rule is needed for make of Solaris 2.5.1 to override its
# built-in .y.o rule (which takes precedence over the .y.cpp rule above).
.y.o:
if test -n "$(YTABH)"; then \
$(YACC) $(YACCFLAGS) -d $<; \
else \
$(YACC) $(YACCFLAGS) $<; \
fi
-test -f y.tab.h && mv y.tab.h y_tab.h
-test -f y.tab.c && mv y.tab.c y_tab.c
mv y_tab.c $(YTABC)
test -z "$(YTABH)" || mv y_tab.h $(YTABH)
$(COMPILE.cpp) $(EXTRA_CCFLAGS) $(YTABC)
.man.n:
@echo Making $@ from $<
@-rm -f $@
@sed -e "s|@BINDIR@|$(bindir)|g" \
-e "s|@FONTDIR@|$(fontdir)|g" \
-e "s|@LOCALFONTDIR@|$(localfontdir)|g" \
-e "s|@LEGACYFONTDIR@|$(legacyfontdir)|g" \
-e "s|@MACRODIR@|$(tmacdir)|g" \
-e "s|@SYSTEMMACRODIR@|$(systemtmacdir)|g" \
-e "s|@LOCALMACRODIR@|$(localtmacdir)|g" \
-e "s|@DOCDIR@|$(docdir)|g" \
-e "s|@EXAMPLEDIR@|$(exampledir)|g" \
-e "s|@HTMLDOCDIR@|$(htmldocdir)|g" \
-e "s|@PDFDOCDIR@|$(pdfdocdir)|g" \
-e "s|@DEVICE@|$(DEVICE)|g" \
-e "s|@DEFAULT_INDEX@|$(indexdir)/$(indexname)|g" \
-e "s|@DEFAULT_INDEX_NAME@|$(indexname)|g" \
-e "s|@INDEX_SUFFIX@|$(indexext)|g" \
-e "s|@COMMON_WORDS_FILE@|$(common_words_file)|g" \
-e "s|@MAN1EXT@|$(man1ext)|g" \
-e "s|@MAN5EXT@|$(man5ext)|g" \
-e "s|@MAN7EXT@|$(man7ext)|g" \
-e "s|@TMAC_S_PREFIX@|$(tmac_s_prefix)|g" \
-e "s|@TMAC_M_PREFIX@|$(tmac_m_prefix)|g" \
-e "s|@TMAC_AN_PREFIX@|$(tmac_an_prefix)|g" \
-e "s|@TMAC_MDIR@|$(tmacdir)/mm|g" \
-e "s|@BROKEN_SPOOLER_FLAGS@|$(BROKEN_SPOOLER_FLAGS)|g" \
-e "s|@VERSION@|$(version)$(revision)|g" \
-e "s|@MDATE@|`$(SHELL) $(top_srcdir)/mdate.sh $<`|g" \
-e "s|@g@|$(g)|g" \
-e "s!@G@!`echo $(g) | tr [a-z] [A-Z]`!g" \
$< >$@
.PHONY: install_man
install_man:
-test -d $(manroot) || $(mkinstalldirs) $(manroot)
-test -d $(man1dir) || $(mkinstalldirs) $(man1dir)
@-pages="$(MAN1)"; \
for p in $$pages; do \
prog=`basename $$p .n`; \
target=$(man1dir)/$(NAMEPREFIX)$$prog.$(man1ext); \
rm -f $$target; \
echo $(INSTALL_DATA) $$p $$target; \
$(INSTALL_DATA) $$p $$target; \
done
-test -d $(man5dir) || $(mkinstalldirs) $(man5dir)
@-pages="$(MAN5)"; \
for p in $$pages; do \
target=$(man5dir)/`basename $$p .n`.$(man5ext); \
rm -f $$target; \
echo $(INSTALL_DATA) $$p $$target; \
$(INSTALL_DATA) $$p $$target; \
done
-test -d $(man7dir) || $(mkinstalldirs) $(man7dir)
@-pages="$(MAN7)"; \
for p in $$pages; do \
target=$(man7dir)/`basename $$p .n`.$(man7ext); \
rm -f $$target; \
echo $(INSTALL_DATA) $$p $$target; \
$(INSTALL_DATA) $$p $$target; \
done
.PHONY: uninstall_man
uninstall_man:
@-pages="$(MAN1)"; \
for p in $$pages; do \
target=$(man1dir)/$(NAMEPREFIX)`basename $$p .n`.$(man1ext); \
echo rm -f $$target; \
rm -f $$target; \
done
@-pages="$(MAN5)"; \
for p in $$pages; do \
target=$(man5dir)/`basename $$p .n`.$(man5ext); \
echo rm -f $$target; \
rm -f $$target; \
done
@-pages="$(MAN7)"; \
for p in $$pages; do \
target=$(man7dir)/`basename $$p .n`.$(man7ext); \
echo rm -f $$target; \
rm -f $$target; \
done
.PHONY: install_prog
install_prog:
-test -d $(bindir) || $(mkinstalldirs) $(bindir)
rm -f $(bindir)/$(NAMEPREFIX)$(PROG)
$(INSTALL_PROGRAM) $(PROG) $(bindir)/$(NAMEPREFIX)$(PROG)
.PHONY: uninstall_prog
uninstall_prog:
-rm -f $(bindir)/$(NAMEPREFIX)$(PROG)
.PHONY: install_dev
install_dev:
-test -d $(datadir) || $(mkinstalldirs) $(datadir)
-test -d $(dataprogramdir) || $(mkinstalldirs) $(dataprogramdir)
-test -d $(datasubdir) || $(mkinstalldirs) $(datasubdir)
-test -d $(fontdir) || $(mkinstalldirs) $(fontdir)
-test -d $(fontsubdir) || $(mkinstalldirs) $(fontsubdir)
-if test -d $(srcdir)/generate; then \
test -d $(fontsubdir)/generate \
|| $(mkinstalldirs) $(fontsubdir)/generate; \
fi
-test -z "$(DEVFILES)" \
|| for f in ""$(DEVFILES); do \
rm -f $(fontsubdir)/$$f; \
if test -f $$f; then \
$(INSTALL_DATA) $$f $(fontsubdir)/$$f; \
else \
$(INSTALL_DATA) $(srcdir)/$$f $(fontsubdir)/$$f; \
fi; \
done
-test -z "$(DEVSCRIPTS)" \
|| for f in ""$(DEVSCRIPTS); do \
rm -f $(fontsubdir)/$$f; \
if test -f $$f; then \
$(INSTALL_SCRIPT) $$f $(fontsubdir)/$$f; \
else \
$(INSTALL_SCRIPT) $(srcdir)/$$f $(fontsubdir)/$$f; \
fi; \
done
.PHONY: uninstall_dev
uninstall_dev:
-test -z "$(DEVFILES)$(DEVSCRIPTS)" \
|| for f in ""$(DEVFILES) $(DEVSCRIPTS); do \
rm -f $(fontsubdir)/$$f; \
done
-test -d $(fontsubdir)/generate && rmdir $(fontsubdir)/generate
-rmdir $(fontsubdir)
.PHONY: depend_src
depend_src: depend.temp
mv depend.temp Makefile.dep
depend.temp: FORCE
> depend.temp;
if test -f "$(srcdir)/$(YTABC)"; then \
ytabc="$(srcdir)/$(YTABC)"; \
else \
ytabc="$(YTABC)"; \
fi; \
test -z "$(CCSRCS)$(YTABC)" \
|| $(CCC) $(ALL_CCFLAGS) -MM $(CCSRCS) $$ytabc >>depend.temp
test -z "$(CSRCS)" \
|| $(CC) $(ALL_CFLAGS) -MM $(CSRCS) >>depend.temp
test -z "$(YTABH)" \
|| (sed -e 's|$(YTABH)|$(YTABC)|g' depend.temp >depend1.temp; \
mv depend1.temp depend.temp)
.PHONY: TAGS_src
TAGS_src:
$(ETAGS) $(ETAGSFLAGS) $(CCSRCS) $(CSRCS)
test -z "$(GRAM)$(HDRS)" \
|| $(ETAGS) $(ETAGSFLAGS) -a $(ETAGSCCFLAG) $(GRAM) $(HDRS)
# This rule is only considered for the subdir_Makefile target.
Makefile:
-rm -f Makefile
echo srcdir=$(srcdir) >>Makefile
echo VPATH=$(VPATH) >>Makefile
cat $(MAKEFILEPARTS) /dev/null >>Makefile
FORCE:
.NOEXPORT: