diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2014-08-05 05:27:16 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2014-08-05 05:27:16 +0000 |
commit | 8d0d88274b986b8bc6586ad36830b9148ab1cec6 (patch) | |
tree | 649e429aed60b755fb4a9d997bf3a93129c9b803 /Makefile | |
parent | 4648a9d409c36a3a7d5dd56469b60839f04b6877 (diff) | |
download | mandoc-8d0d88274b986b8bc6586ad36830b9148ab1cec6.tar.gz |
Switch to autogenerated dependency rules; they are less error-prone.
Provide a maintainer target to regenerate them.
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 172 |
1 files changed, 78 insertions, 94 deletions
@@ -127,81 +127,40 @@ TESTSRCS = test-fgetln.c \ test-strptime.c \ test-strsep.c -SRCS = LICENSE \ - Makefile \ - NEWS \ - TODO \ - apropos.1 \ - apropos.c \ +SRCS = apropos.c \ arch.c \ - arch.in \ att.c \ - att.in \ cgi.c \ - cgi.h.example \ chars.c \ - chars.in \ compat_fgetln.c \ compat_getsubopt.c \ compat_ohash.c \ - compat_ohash.h \ compat_reallocarray.c \ compat_strcasestr.c \ compat_strlcat.c \ compat_strlcpy.c \ compat_strsep.c \ - config.h.post \ - config.h.pre \ - configure \ - demandoc.1 \ demandoc.c \ - eqn.7 \ eqn.c \ eqn_html.c \ eqn_term.c \ - example.style.css \ - gmdiff \ html.c \ - html.h \ lib.c \ - lib.in \ - libman.h \ - libmandoc.h \ - libmdoc.h \ - libroff.h \ main.c \ - main.h \ - makewhatis.8 \ - man.7 \ man.c \ - man.cgi.8 \ - man-cgi.css \ - man.h \ man_hash.c \ man_html.c \ man_macro.c \ man_term.c \ man_validate.c \ - mandoc.1 \ - mandoc.3 \ mandoc.c \ - mandoc.db.5 \ - mandoc.h \ mandoc_aux.c \ - mandoc_aux.h \ - mandoc_char.7 \ - mandoc_html.3 \ mandocdb.c \ manpage.c \ manpath.c \ - manpath.h \ - mansearch.3 \ mansearch.c \ - mansearch.h \ mansearch_const.c \ - mdoc.7 \ mdoc.c \ - mdoc.h \ mdoc_argv.c \ mdoc_hash.c \ mdoc_html.c \ @@ -210,20 +169,11 @@ SRCS = LICENSE \ mdoc_term.c \ mdoc_validate.c \ msec.c \ - msec.in \ out.c \ - out.h \ - preconv.1 \ preconv.c \ - predefs.in \ read.c \ - roff.7 \ roff.c \ st.c \ - st.in \ - style.css \ - tbl.3 \ - tbl.7 \ tbl.c \ tbl_data.c \ tbl_html.c \ @@ -231,14 +181,67 @@ SRCS = LICENSE \ tbl_opts.c \ tbl_term.c \ term.c \ - term.h \ term_ascii.c \ term_ps.c \ tree.c \ vol.c \ - vol.in \ $(TESTSRCS) +DISTFILES = LICENSE \ + Makefile \ + Makefile.depend \ + NEWS \ + TODO \ + apropos.1 \ + arch.in \ + att.in \ + cgi.h.example \ + chars.in \ + compat_ohash.h \ + config.h.post \ + config.h.pre \ + configure \ + demandoc.1 \ + eqn.7 \ + example.style.css \ + gmdiff \ + html.h \ + lib.in \ + libman.h \ + libmandoc.h \ + libmdoc.h \ + libroff.h \ + main.h \ + makewhatis.8 \ + man-cgi.css \ + man.7 \ + man.cgi.8 \ + man.h \ + mandoc.1 \ + mandoc.3 \ + mandoc.db.5 \ + mandoc.h \ + mandoc_aux.h \ + mandoc_char.7 \ + mandoc_html.3 \ + manpath.h \ + mansearch.3 \ + mansearch.h \ + mdoc.7 \ + mdoc.h \ + msec.in \ + out.h \ + preconv.1 \ + predefs.in \ + roff.7 \ + st.in \ + style.css \ + tbl.3 \ + tbl.7 \ + term.h \ + vol.in \ + $(SRCS) + LIBMAN_OBJS = man.o \ man_hash.o \ man_macro.o \ @@ -280,40 +283,11 @@ COMPAT_OBJS = compat_fgetln.o \ compat_strlcpy.o \ compat_strsep.o -# === DEPENDENCY HANDLING ============================================== - -all: base-build $(BUILD_TARGETS) - -base-build: $(BASEBIN) - -db-build: $(DBBIN) - -cgi-build: $(CGIBIN) - -install: base-install $(INSTALL_TARGETS) - -arch.o: arch.in -att.o: att.in -chars.o: chars.in -lib.o: lib.in -msec.o: msec.in -roff.o: predefs.in -st.o: st.in -vol.o: vol.in -cgi.o: cgi.h - -$(LIBMAN_OBJS): libman.h -$(LIBMDOC_OBJS): libmdoc.h -$(LIBROFF_OBJS): libroff.h -$(LIBMANDOC_OBJS): mandoc.h mandoc_aux.h mdoc.h man.h libmandoc.h config.h -$(COMPAT_OBJS): config.h compat_ohash.h - MANDOC_HTML_OBJS = eqn_html.o \ html.o \ man_html.o \ mdoc_html.o \ tbl_html.o -$(MANDOC_HTML_OBJS): html.h MANDOC_MAN_OBJS = mdoc_man.o @@ -324,7 +298,6 @@ MANDOC_TERM_OBJS = eqn_term.o \ term_ascii.o \ term_ps.o \ tbl_term.o -$(MANDOC_TERM_OBJS): term.h MANDOC_OBJS = $(MANDOC_HTML_OBJS) \ $(MANDOC_MAN_OBJS) \ @@ -332,31 +305,22 @@ MANDOC_OBJS = $(MANDOC_HTML_OBJS) \ main.o \ out.o \ tree.o -$(MANDOC_OBJS): main.h mandoc.h mandoc_aux.h mdoc.h man.h config.h out.h MAKEWHATIS_OBJS = mandocdb.o mansearch_const.o manpath.o -$(MAKEWHATIS_OBJS): mansearch.h mandoc.h mandoc_aux.h \ - mdoc.h man.h config.h manpath.h PRECONV_OBJS = preconv.o -$(PRECONV_OBJS): config.h APROPOS_OBJS = apropos.o mansearch.o mansearch_const.o manpath.o -$(APROPOS_OBJS): config.h mandoc.h mandoc_aux.h manpath.h mansearch.h CGI_OBJS = $(MANDOC_HTML_OBJS) \ cgi.o \ mansearch.o \ mansearch_const.o \ out.o -$(CGI_OBJS): main.h out.h config.h mandoc.h mandoc_aux.h \ - manpath.h mansearch.h MANPAGE_OBJS = manpage.o mansearch.o mansearch_const.o manpath.o -$(MANPAGE_OBJS): config.h mandoc.h mandoc_aux.h manpath.h mansearch.h DEMANDOC_OBJS = demandoc.o -$(DEMANDOC_OBJS): config.h mandoc.h man.h mdoc.h WWW_MANS = apropos.1.html \ demandoc.1.html \ @@ -385,8 +349,22 @@ WWW_MANS = apropos.1.html \ WWW_OBJS = mdocml.tar.gz \ mdocml.sha256 +# === DEPENDENCY HANDLING ============================================== + +all: base-build $(BUILD_TARGETS) + +base-build: $(BASEBIN) + +db-build: $(DBBIN) + +cgi-build: $(CGIBIN) + +install: base-install $(INSTALL_TARGETS) + www: $(WWW_OBJS) $(WWW_MANS) +.include "Makefile.depend" + # === TARGETS CONTAINING SHELL COMMANDS ================================ clean: @@ -457,6 +435,12 @@ www-install: www $(INSTALL_DATA) mdocml.sha256 \ $(DESTDIR)$(HTDOCDIR)/snapshots/mdocml-$(VERSION).sha256 +Makefile.depend: $(SRCS) config.h Makefile + mkdep -f Makefile.depend $(CFLAGS) $(SRCS) + perl -e 'undef $$/; $$_ = <>; s|/usr/include/\S+||g; \ + s|\\\n||g; s| +| |g; print;' Makefile.depend > Makefile.tmp + mv Makefile.tmp Makefile.depend + libmandoc.a: $(COMPAT_OBJS) $(LIBMANDOC_OBJS) $(AR) rs $@ $(COMPAT_OBJS) $(LIBMANDOC_OBJS) @@ -484,9 +468,9 @@ demandoc: $(DEMANDOC_OBJS) libmandoc.a mdocml.sha256: mdocml.tar.gz sha256 mdocml.tar.gz > $@ -mdocml.tar.gz: $(SRCS) +mdocml.tar.gz: $(DISTFILES) mkdir -p .dist/mdocml-$(VERSION)/ - $(INSTALL_SOURCE) $(SRCS) .dist/mdocml-$(VERSION) + $(INSTALL_SOURCE) $(DISTFILES) .dist/mdocml-$(VERSION) chmod 755 .dist/mdocml-$(VERSION)/configure ( cd .dist/ && tar zcf ../$@ mdocml-$(VERSION) ) rm -rf .dist/ |