From 4b93be289bc141a15484e782c85020b62b878ec2 Mon Sep 17 00:00:00 2001 From: Omar Polo Date: Mon, 31 Oct 2022 22:53:16 +0000 Subject: [PATCH] rework `make dist' --- Makefile | 149 +++++++++++++---------------------------------- compat/Makefile | 29 +++++++++ contrib/Makefile | 20 +++++++ have/Makefile | 35 +++++++++++ regress/Makefile | 27 ++++++++- 5 files changed, 151 insertions(+), 109 deletions(-) create mode 100644 compat/Makefile create mode 100644 contrib/Makefile create mode 100644 have/Makefile diff --git a/Makefile b/Makefile index b8ee92b..b7d3593 100644 --- a/Makefile +++ b/Makefile @@ -18,50 +18,6 @@ # all. TESTS= -TESTSRCS = have/err.c \ - have/explicit_bzero.c \ - have/freezero.c \ - have/getdtablecount.c \ - have/getdtablesize.c \ - have/getprogname.c \ - have/imsg.c \ - have/landlock.c \ - have/libevent.c \ - have/libevent2.c \ - have/libtls.c \ - have/noop.c \ - have/openssl.c \ - have/pr_set_name.c \ - have/program_invocation_short_name.c \ - have/queue_h.c \ - have/reallocarray.c \ - have/recallocarray.c \ - have/setproctitle.c \ - have/strlcat.c \ - have/strlcpy.c \ - have/strtonum.c \ - have/tree_h.c \ - have/vasprintf.c - -COMPATS = compat/err.c \ - compat/explicit_bzero.c \ - compat/freezero.c \ - compat/getdtablecount.c \ - compat/getdtablesize.c \ - compat/getprogname.c \ - compat/imsg-buffer.c \ - compat/imsg.c \ - compat/imsg.h \ - compat/queue.h \ - compat/reallocarray.c \ - compat/recallocarray.c \ - compat/setproctitle.c \ - compat/strlcat.c \ - compat/strlcpy.c \ - compat/strtonum.c \ - compat/tree.h \ - compat/vasprintf.c - GMID_SRCS = dirs.c \ fcgi.c \ gmid.c \ @@ -106,63 +62,12 @@ SRCS = gmid.h \ ${GE_SRCS} \ ${GG_SRCS} -REGRESSFILES = regress/Makefile \ - regress/env \ - regress/err \ - regress/example.mime.types \ - regress/fcgi-test.c \ - regress/fill-file.c \ - regress/hello \ - regress/invalid \ - regress/iri_test.c \ - regress/lib.sh \ - regress/max-length-reply \ - regress/puny-test.c \ - regress/regress \ - regress/serve-bigfile \ - regress/sha \ - regress/slow \ - regress/tests.sh \ - regress/valid.ext - -EXTRAS = ChangeLog \ - LICENSE \ - Makefile \ - Makefile.depend \ - README.md \ - configure \ - configure.local.example \ - ge.1 \ - gg.1 \ - gmid.8 \ - gmid.conf.5 - -CONTRIB = contrib/Dockerfile \ - contrib/gencert \ - contrib/gmid.service \ - contrib/gmid.sysusers \ - contrib/mime.types \ - contrib/README \ - contrib/renew-certs \ - contrib/vim/ftdetect/gmid.vim \ - contrib/vim/ftplugin/gmid.vim \ - contrib/vim/indent/gmid.vim \ - contrib/vim/syntax_checkers/gmid/gmid.vim \ - contrib/vim/syntax/gmid.vim - -DISTFILES = ${EXTRAS} \ - ${CONTRIB} \ - ${COMPATS} \ - ${REGRESSFILES} \ - ${SRCS} \ - ${TESTSRCS} - DISTNAME = gmid-${VERSION} all: Makefile.local gmid ge gg .PHONY: all static clean cleanall test regress install -Makefile.local config.h: configure ${TESTSRCS} +Makefile.local config.h: configure @echo "$@ is out of date; please run ./configure" @exit 1 @@ -225,6 +130,41 @@ uninstall: .c.o: ${CC} ${CFLAGS} -c $< -o $@ +# -- maintainer targets -- + +DISTFILES = .cirrus.yml \ + .dockerignore \ + .gitignore \ + ChangeLog \ + LICENSE \ + Makefile \ + Makefile.depend \ + README.md \ + configure \ + configure.local.example \ + dirs.c \ + fcgi.c \ + ge.1 \ + ge.c \ + gg.1 \ + gg.c \ + gmid.8 \ + gmid.c \ + gmid.conf.5 \ + gmid.h \ + iri.c \ + landlock_shim.h \ + log.c \ + mime.c \ + parse.y \ + proxy.c \ + puny.c \ + sandbox.c \ + server.c \ + utf8.c \ + utils.c \ + y.tab.c + depend: config.h y.tab.c mkdep -f Makefile.tmp1 ${CFLAGS} ${GE_SRCS} ${GG_SRCS} ${GMID_SRCS} \ ${COBJSx:.o=.c} @@ -240,18 +180,11 @@ ${DISTNAME}.sha256: ${DISTNAME}.tar.gz ${DISTNAME}.tar.gz: ${DISTFILES} mkdir -p .dist/${DISTNAME}/ - ${INSTALL} -m 0644 ${SRCS} ${EXTRAS} .dist/${DISTNAME} + ${INSTALL} -m 0644 ${DISTFILES} .dist/${DISTNAME}/ cd .dist/${DISTNAME} && chmod 755 configure - mkdir -p .dist/${DISTNAME}/contrib - ${INSTALL} -m 0644 ${CONTRIB} .dist/${DISTNAME}/contrib - cd .dist/${DISTNAME}/contrib && chmod 755 gencert renew-certs - mkdir -p .dist/${DISTNAME}/compat - ${INSTALL} -m 0644 ${COMPATS} .dist/${DISTNAME}/compat - mkdir -p .dist/${DISTNAME}/have - ${INSTALL} -m 0644 ${TESTSRCS} .dist/${DISTNAME}/have - mkdir -p .dist/${DISTNAME}/regress - ${INSTALL} -m 0644 ${REGRESSFILES} .dist/${DISTNAME}/regress - cd .dist/${DISTNAME}/regress && chmod 755 env err hello invalid \ - max-length-reply regress sha slow + ${MAKE} -C compat DESTDIR=${PWD}/.dist/${DISTNAME}/compat dist + ${MAKE} -C contrib DESTDIR=${PWD}/.dist/${DISTNAME}/contrib dist + ${MAKE} -C have DESTDIR=${PWD}/.dist/${DISTNAME}/have dist + ${MAKE} -C regress DESTDIR=${PWD}/.dist/${DISTNAME}/regress dist cd .dist/ && tar zcf ../$@ ${DISTNAME} rm -rf .dist/ diff --git a/compat/Makefile b/compat/Makefile new file mode 100644 index 0000000..83f439c --- /dev/null +++ b/compat/Makefile @@ -0,0 +1,29 @@ +DISTFILES = Makefile \ + err.c \ + explicit_bzero.c \ + freezero.c \ + getdtablecount.c \ + getdtablesize.c \ + getprogname.c \ + imsg-buffer.c \ + imsg.c \ + imsg.h \ + queue.h \ + reallocarray.c \ + recallocarray.c \ + setproctitle.c \ + strlcat.c \ + strlcpy.c \ + strtonum.c \ + tree.h \ + vasprintf.c + +all: + false + +dist: ${DISTFILES} + mkdir -p ${DESTDIR}/ + ${INSTALL} -m 0644 ${DISTFILES} ${DESTDIR}/ + +.PHONY: all dist +include ../Makefile.local diff --git a/contrib/Makefile b/contrib/Makefile new file mode 100644 index 0000000..9489eea --- /dev/null +++ b/contrib/Makefile @@ -0,0 +1,20 @@ +DISTFILES = Makefile \ + Dockerfile \ + README \ + gencert \ + gmid.service \ + gmid.sysusers \ + mime.types \ + renew-certs + +all: + false + +dist: ${DISTFILES} + mkdir -p ${DESTDIR}/ + ${INSTALL} -m 0644 ${DISTFILES} ${DESTDIR}/ + cd ${DESTDIR} && chmod 755 gencert renew-certs + cp -R vim ${DESTDIR}/vim + +.PHONY: all dist +include ../Makefile.local diff --git a/have/Makefile b/have/Makefile new file mode 100644 index 0000000..cdd0fec --- /dev/null +++ b/have/Makefile @@ -0,0 +1,35 @@ +DISTFILES = Makefile \ + err.c \ + explicit_bzero.c \ + freezero.c \ + getdtablecount.c \ + getdtablesize.c \ + getprogname.c \ + imsg.c \ + landlock.c \ + libevent.c \ + libevent2.c \ + libtls.c \ + noop.c \ + openssl.c \ + pr_set_name.c \ + program_invocation_short_name.c \ + queue_h.c \ + reallocarray.c \ + recallocarray.c \ + setproctitle.c \ + strlcat.c \ + strlcpy.c \ + strtonum.c \ + tree_h.c \ + vasprintf.c + +all: + false + +dist: ${DISTFILES} + mkdir -p ${DESTDIR}/ + ${INSTALL} -m 0644 ${DISTFILES} ${DESTDIR}/ + +.PHONY: all dist +include ../Makefile.local diff --git a/regress/Makefile b/regress/Makefile index 57013bf..5194636 100644 --- a/regress/Makefile +++ b/regress/Makefile @@ -2,11 +2,30 @@ # all. TESTS= +DISTFILES = Makefile \ + env \ + err \ + example.mime.types \ + fcgi-test.c \ + fill-file.c \ + hello \ + invalid \ + iri_test.c \ + lib.sh \ + max-length-reply \ + puny-test.c \ + regress \ + serve-bigfile \ + sha \ + slow \ + tests.sh \ + valid.ext + include ../Makefile.local COMPAT= ${COBJS:%=../%} -.PHONY: all data clean regress +.PHONY: all data clean dist all: data puny-test iri_test fcgi-test ./regress ${TESTS} @@ -87,3 +106,9 @@ testdata: fill-file cp hello testdata/dir cp testdata/index.gmi testdata/dir/foo.gmi touch testdata/test.m3u8 testdata/foo.1 + +dist: ${DISTFILES} + mkdir -p ${DESTDIR}/ + ${INSTALL} -m 0644 ${DISTFILES} ${DESTDIR}/ + cd ${DESTDIR}/ && chmod +x env err hello invalid \ + max-length-reply regress sha slow