* Re: mdocml: Switch to autogenerated dependency rules; they are less
[not found] <201408050527.s755RG1I009029@krisdoz.my.domain>
@ 2014-08-05 9:50 ` Kristaps Dzonsons
2014-08-05 9:56 ` Kristaps Dzonsons
2014-08-05 11:32 ` Ingo Schwarze
0 siblings, 2 replies; 3+ messages in thread
From: Kristaps Dzonsons @ 2014-08-05 9:50 UTC (permalink / raw)
To: discuss, Ingo Schwarze
On 05/08/2014 07:27, schwarze@mdocml.bsd.lv wrote:
> Log Message:
> -----------
> Switch to autogenerated dependency rules; they are less error-prone.
> Provide a maintainer target to regenerate them.
>
> Modified Files:
> --------------
> mdocml:
> Makefile
>
> Added Files:
> -----------
> mdocml:
> Makefile.depend
>
Ingo,
I'm afraid this breaks the build for gmake systems (Linux, Mac, etc.),
which have different "include" syntax. To GNU-ify it, one would need to
patch the Makefile as follows (the dash before "include" can be omitted
entirely, as well):
Index: Makefile
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/Makefile,v
retrieving revision 1.430
diff -u -p -u -r1.430 Makefile
--- Makefile 5 Aug 2014 05:48:56 -0000 1.430
+++ Makefile 5 Aug 2014 08:49:41 -0000
@@ -369,7 +369,7 @@ install: base-install $(INSTALL_TARGETS)
www: $(WWW_OBJS) $(WWW_MANS)
-.include "Makefile.depend"
+-include "Makefile.depend"
# === TARGETS CONTAINING SHELL COMMANDS ================================
Unfortunately, there's no portable way to do this. The POSIX document
for make only says that "include" is a vendor extension.
http://pubs.opengroup.org/onlinepubs/009695399/utilities/make.html
In the interests of history, I couldn't find the "include" statement in
V7 UNIX's "make" utility:
http://minnie.tuhs.org/cgi-bin/utree.pl?file=V7/usr/src/cmd/make
However, NetBSD's earliest inclusion of de Boor's pmake from 386BSD did:
http://cvsweb.netbsd.org/bsdweb.cgi/src/usr.bin/make/?only_with_tag=netbsd-0-8
Neat. Unfortunately, I can't find the original version of GNU make.
(Where are the originals for any GNU system?)
Since the Makefile.depend target would only be built in changing files,
which hopefully isn't often, and it already uses non-standard tools, and
moreover Makefile.depend is only 68 lines long, it might be best to just
inline it at the bottom of the file. This would, yes, clutter the
Makefile a bit, but would make things a lot easier for portability's sake.
(Apropos nothing, in looking at OpenBSD's make sources, it seems pretty
easy to add support for "-include", though the base "include" wouldn't
be: see the parse_as_special_line function. That still wouldn't solve
the problem for the other BSDs, unfortunately...)
Thoughts?
Best,
Kristaps
> Revision Data
> -------------
> --- /dev/null
> +++ Makefile.depend
> @@ -0,0 +1,68 @@
> +apropos.o: apropos.c config.h manpath.h mansearch.h
> +arch.o: arch.c config.h mdoc.h libmdoc.h arch.in
> +att.o: att.c config.h mdoc.h libmdoc.h att.in
> +cgi.o: cgi.c config.h mandoc.h mandoc_aux.h main.h manpath.h mansearch.h cgi.h
> +chars.o: chars.c config.h mandoc.h mandoc_aux.h libmandoc.h chars.in
> +compat_fgetln.o: compat_fgetln.c config.h
> +compat_getsubopt.o: compat_getsubopt.c config.h
> +compat_ohash.o: compat_ohash.c config.h
> +compat_reallocarray.o: compat_reallocarray.c config.h
> +compat_strcasestr.o: compat_strcasestr.c config.h
> +compat_strlcat.o: compat_strlcat.c config.h
> +compat_strlcpy.o: compat_strlcpy.c config.h
> +compat_strsep.o: compat_strsep.c config.h
> +demandoc.o: demandoc.c config.h man.h mdoc.h mandoc.h
> +eqn.o: eqn.c config.h mandoc.h mandoc_aux.h libmandoc.h libroff.h
> +eqn_html.o: eqn_html.c config.h mandoc.h out.h html.h
> +eqn_term.o: eqn_term.c config.h mandoc.h out.h term.h
> +html.o: html.c config.h mandoc.h mandoc_aux.h libmandoc.h out.h html.h main.h
> +lib.o: lib.c config.h mdoc.h libmdoc.h lib.in
> +main.o: main.c config.h mandoc.h mandoc_aux.h main.h mdoc.h man.h
> +man.o: man.c config.h man.h mandoc.h mandoc_aux.h libman.h libmandoc.h
> +man_hash.o: man_hash.c config.h man.h mandoc.h libman.h
> +man_html.o: man_html.c config.h mandoc.h mandoc_aux.h out.h html.h man.h main.h
> +man_macro.o: man_macro.c config.h man.h mandoc.h libmandoc.h libman.h
> +man_term.o: man_term.c config.h mandoc.h mandoc_aux.h out.h man.h term.h main.h
> +man_validate.o: man_validate.c config.h man.h mandoc.h mandoc_aux.h libman.h libmandoc.h
> +mandoc.o: mandoc.c config.h mandoc.h mandoc_aux.h libmandoc.h
> +mandoc_aux.o: mandoc_aux.c config.h mandoc.h mandoc_aux.h
> +mandocdb.o: mandocdb.c config.h mdoc.h man.h mandoc.h mandoc_aux.h manpath.h mansearch.h
> +manpage.o: manpage.c config.h manpath.h mansearch.h
> +manpath.o: manpath.c config.h mandoc_aux.h manpath.h
> +mansearch.o: mansearch.c config.h mandoc.h mandoc_aux.h manpath.h mansearch.h
> +mansearch_const.o: mansearch_const.c manpath.h mansearch.h
> +mdoc.o: mdoc.c config.h mdoc.h mandoc.h mandoc_aux.h libmdoc.h libmandoc.h
> +mdoc_argv.o: mdoc_argv.c config.h mdoc.h mandoc.h mandoc_aux.h libmdoc.h libmandoc.h
> +mdoc_hash.o: mdoc_hash.c config.h mdoc.h libmdoc.h
> +mdoc_html.o: mdoc_html.c config.h mandoc.h mandoc_aux.h out.h html.h mdoc.h main.h
> +mdoc_macro.o: mdoc_macro.c config.h mdoc.h mandoc.h libmdoc.h libmandoc.h
> +mdoc_man.o: mdoc_man.c config.h mandoc.h mandoc_aux.h out.h man.h mdoc.h main.h
> +mdoc_term.o: mdoc_term.c config.h mandoc.h mandoc_aux.h out.h term.h mdoc.h main.h
> +mdoc_validate.o: mdoc_validate.c config.h mdoc.h mandoc.h mandoc_aux.h libmdoc.h libmandoc.h
> +msec.o: msec.c config.h mandoc.h libmandoc.h msec.in
> +out.o: out.c config.h mandoc_aux.h mandoc.h out.h
> +preconv.o: preconv.c config.h
> +read.o: read.c config.h mandoc.h mandoc_aux.h libmandoc.h mdoc.h man.h main.h
> +roff.o: roff.c config.h mandoc.h mandoc_aux.h libroff.h libmandoc.h predefs.in
> +st.o: st.c config.h mdoc.h libmdoc.h st.in
> +tbl.o: tbl.c config.h mandoc.h mandoc_aux.h libmandoc.h libroff.h
> +tbl_data.o: tbl_data.c config.h mandoc.h mandoc_aux.h libmandoc.h libroff.h
> +tbl_html.o: tbl_html.c config.h mandoc.h out.h html.h
> +tbl_layout.o: tbl_layout.c config.h mandoc.h mandoc_aux.h libmandoc.h libroff.h
> +tbl_opts.o: tbl_opts.c config.h mandoc.h libmandoc.h libroff.h
> +tbl_term.o: tbl_term.c config.h mandoc.h out.h term.h
> +term.o: term.c config.h mandoc.h mandoc_aux.h out.h term.h main.h
> +term_ascii.o: term_ascii.c config.h mandoc.h mandoc_aux.h out.h term.h main.h
> +term_ps.o: term_ps.c config.h mandoc.h mandoc_aux.h out.h main.h term.h
> +tree.o: tree.c config.h mandoc.h mdoc.h man.h main.h
> +vol.o: vol.c config.h mdoc.h libmdoc.h vol.in
> +test-fgetln.o: test-fgetln.c
> +test-getsubopt.o: test-getsubopt.c
> +test-mmap.o: test-mmap.c
> +test-ohash.o: test-ohash.c
> +test-reallocarray.o: test-reallocarray.c
> +test-strcasestr.o: test-strcasestr.c
> +test-strlcat.o: test-strlcat.c
> +test-strlcpy.o: test-strlcpy.c
> +test-strptime.o: test-strptime.c
> +test-strsep.o: test-strsep.c
> Index: Makefile
> ===================================================================
> RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/Makefile,v
> retrieving revision 1.428
> retrieving revision 1.429
> diff -LMakefile -LMakefile -u -p -r1.428 -r1.429
> --- Makefile
> +++ Makefile
> @@ -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/
> --
> To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
>
--
To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: mdocml: Switch to autogenerated dependency rules; they are less
2014-08-05 9:50 ` mdocml: Switch to autogenerated dependency rules; they are less Kristaps Dzonsons
@ 2014-08-05 9:56 ` Kristaps Dzonsons
2014-08-05 11:32 ` Ingo Schwarze
1 sibling, 0 replies; 3+ messages in thread
From: Kristaps Dzonsons @ 2014-08-05 9:56 UTC (permalink / raw)
To: discuss, Ingo Schwarze
Quick correction: the quotes around the "Makefile.depend" need to be
removed for gmake, else the file's looked up elsewhere.
Index: Makefile
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/Makefile,v
retrieving revision 1.430
diff -u -p -u -r1.430 Makefile
--- Makefile 5 Aug 2014 05:48:56 -0000 1.430
+++ Makefile 5 Aug 2014 09:56:33 -0000
@@ -369,7 +369,7 @@ install: base-install $(INSTALL_TARGETS)
www: $(WWW_OBJS) $(WWW_MANS)
-.include "Makefile.depend"
+-include Makefile.depend
# === TARGETS CONTAINING SHELL COMMANDS ================================
--
To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: mdocml: Switch to autogenerated dependency rules; they are less
2014-08-05 9:50 ` mdocml: Switch to autogenerated dependency rules; they are less Kristaps Dzonsons
2014-08-05 9:56 ` Kristaps Dzonsons
@ 2014-08-05 11:32 ` Ingo Schwarze
1 sibling, 0 replies; 3+ messages in thread
From: Ingo Schwarze @ 2014-08-05 11:32 UTC (permalink / raw)
To: Kristaps Dzonsons; +Cc: discuss
Hi Kristaps,
Kristaps Dzonsons wrote on Tue, Aug 05, 2014 at 11:50:23AM +0200:
> Unfortunately, there's no portable way to do this. The POSIX
> document for make only says that "include" is a vendor extension.
>
> http://pubs.opengroup.org/onlinepubs/009695399/utilities/make.html
That's outdated, and the current document is already
more than half a decade old:
http://pubs.opengroup.org/onlinepubs/9699919799/toc.htm
I knew there was a portable version of the include statement
omitting all the bells and whistles, but neglected to check
the exact syntax before committing. The fix i committed now
conforms to POSIX and works with both OpenBSD make and gmake.
Thanks for the hint!
Yours,
Ingo
--
To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-08-05 11:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <201408050527.s755RG1I009029@krisdoz.my.domain>
2014-08-05 9:50 ` mdocml: Switch to autogenerated dependency rules; they are less Kristaps Dzonsons
2014-08-05 9:56 ` Kristaps Dzonsons
2014-08-05 11:32 ` Ingo Schwarze
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).