imakefile-guidelines: some incremental improvements - bitreich-style - Style guide for programmers. Err bitreich.org 70
hgit clone git://bitreich.org/bitreich-style URL:git://bitreich.org/bitreich-style bitreich.org 70
1Log /scm/bitreich-style/log.gph bitreich.org 70
1Files /scm/bitreich-style/files.gph bitreich.org 70
1Refs /scm/bitreich-style/refs.gph bitreich.org 70
1Tags /scm/bitreich-style/tag bitreich.org 70
1README /scm/bitreich-style/file/README.md.gph bitreich.org 70
1LICENSE /scm/bitreich-style/file/LICENSE.gph bitreich.org 70
i--- Err bitreich.org 70
1commit 60d0637f5edd99ec9ee1175d37a3f7b03db3d318 /scm/bitreich-style/commit/60d0637f5edd99ec9ee1175d37a3f7b03db3d318.gph bitreich.org 70
1parent 040830cabbba670cfbac39d214fe274d7c10b88d /scm/bitreich-style/commit/040830cabbba670cfbac39d214fe274d7c10b88d.gph bitreich.org 70
hAuthor: Hiltjo Posthuma <hiltjo@codemadness.org> URL:mailto:hiltjo@codemadness.org bitreich.org 70
iDate: Wed, 10 Jun 2020 14:46:27 +0200 Err bitreich.org 70
i Err bitreich.org 70
imakefile-guidelines: some incremental improvements Err bitreich.org 70
i Err bitreich.org 70
i* Fix the direct link to the POSIX make link (it was a HTML frame). Err bitreich.org 70
i* Add a note to make porters-life easier. #porterlivesmatter Err bitreich.org 70
i* Fix ar rc to ar -rc (quinq). Err bitreich.org 70
i* Also copy the LICENSE documentation: cp ${DOC}. Err bitreich.org 70
i* Add some references. Err bitreich.org 70
i* Some line-wrapping fixes. Err bitreich.org 70
i Err bitreich.org 70
iDiffstat: Err bitreich.org 70
i M c/makefile-guideline.txt | 42 ++++++++++++++++++++----------- Err bitreich.org 70
i Err bitreich.org 70
i1 file changed, 27 insertions(+), 15 deletions(-) Err bitreich.org 70
i--- Err bitreich.org 70
1diff --git a/c/makefile-guideline.txt b/c/makefile-guideline.txt /scm/bitreich-style/file/c/makefile-guideline.txt.gph bitreich.org 70
i@@ -33,6 +33,14 @@ Do not use GNUisms in Makefiles. Testing with different make implementations Err bitreich.org 70
i like BSD make which mostly respect POSIX is very useful. Use POSIX Makefile Err bitreich.org 70
i rules: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html Err bitreich.org 70
i Err bitreich.org 70
i+Trying to place yourself into the shoes of a package maintainer / porter. This Err bitreich.org 70
i+is helpful to make sure the package is easy to maintain: Err bitreich.org 70
i+ Err bitreich.org 70
i+* https://www.openbsd.org/faq/ports/ Err bitreich.org 70
i+* https://www.netbsd.org/docs/pkgsrc/ Err bitreich.org 70
i+* https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/book.html Err bitreich.org 70
i+* https://wiki.voidlinux.org/A_General_Introduction_To_Package_Creation Err bitreich.org 70
i+ Err bitreich.org 70
i Err bitreich.org 70
i Variables Err bitreich.org 70
i --------- Err bitreich.org 70
i@@ -54,13 +62,19 @@ It is recommended to respect the following commonly-used variables. Err bitreich.org 70
i Specifying compiler and linker flags: Err bitreich.org 70
i Err bitreich.org 70
i * $CC, $CFLAGS, $LDFLAGS, $CPPFLAGS: make sure to respect the default set flags Err bitreich.org 70
i- as specified in POSIX: https://pubs.opengroup.org/onlinepubs/9699919799/ Err bitreich.org 70
i- under the section "Default rules". This make it easier for the ports build system Err bitreich.org 70
i- to use the set variables and not having to patch the Makefile in some way. Err bitreich.org 70
i-* $CFLAGS: do not hard-code optimization flags like (-O2) or diagnostic flags such as Err bitreich.org 70
i- -Wall, -Wextra, -pedantic. Of course do not specify unportable compiler flags. Err bitreich.org 70
i-* $LDFLAGS: do not hard-code linker flags like -s (symbol stripping) or -g, -static Err bitreich.org 70
i- or such flags. Err bitreich.org 70
i+ as specified in POSIX: Err bitreich.org 70
i+ Err bitreich.org 70
i+ https://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html under the Err bitreich.org 70
i+ section "Default rules". This make it easier for the ports build system to use Err bitreich.org 70
i+ the set variables and not having to patch the Makefile in some way. Err bitreich.org 70
i+ Err bitreich.org 70
i+* $CFLAGS: do not hard-code optimization flags like (-O2) or diagnostic flags Err bitreich.org 70
i+ such as -Wall, -Wextra, -pedantic. Of course do not specify unportable compiler Err bitreich.org 70
i+ flags. Err bitreich.org 70
i+ Err bitreich.org 70
i+* $LDFLAGS: do not hard-code linker flags like -s (symbol stripping) or -g, Err bitreich.org 70
i+ -static or such flags. Err bitreich.org 70
i+ Err bitreich.org 70
i * Libraries: using separate variables for compile and link per library (for Err bitreich.org 70
i example libpng, libjpeg) can be useful for building in ports. Err bitreich.org 70
i For example a variable LIBPNG_CFLAGS, LIBPNG_LDFLAGS for the header files or Err bitreich.org 70
i@@ -190,7 +204,7 @@ Compiling, use the system specified CFLAGS and CPPFLAGS. Err bitreich.org 70
i Err bitreich.org 70
i 40 Err bitreich.org 70
i 41 ${LIBJSON}: ${LIBJSONOBJ} Err bitreich.org 70
i- 42 ${AR} rc $@ $? Err bitreich.org 70
i+ 42 ${AR} -rc $@ $? Err bitreich.org 70
i 43 ${RANLIB} $@ Err bitreich.org 70
i 44 Err bitreich.org 70
i Err bitreich.org 70
i@@ -235,7 +249,7 @@ busy as a process. Err bitreich.org 70
i 61 for f in ${BIN}; do chmod 755 "${DESTDIR}${PREFIX}/bin/$$f"; done Err bitreich.org 70
i 62 # installing example files. Err bitreich.org 70
i 63 mkdir -p "${DESTDIR}${DOCPREFIX}" Err bitreich.org 70
i- 64 cp -f README "${DESTDIR}${DOCPREFIX}" Err bitreich.org 70
i+ 64 cp -f ${DOC} "${DESTDIR}${DOCPREFIX}" Err bitreich.org 70
i 65 # installing manual pages for general commands: section 1. Err bitreich.org 70
i 66 mkdir -p "${DESTDIR}${MANPREFIX}/man1" Err bitreich.org 70
i 67 cp -f ${MAN1} "${DESTDIR}${MANPREFIX}/man1" Err bitreich.org 70
i@@ -261,12 +275,10 @@ rmdir returns an error code then that is ok and make still proceeds. Err bitreich.org 70
i 79 .PHONY: all clean dist install uninstall Err bitreich.org 70
i Err bitreich.org 70
i Err bitreich.org 70
i+References Err bitreich.org 70
i+---------- Err bitreich.org 70
i Err bitreich.org 70
i- Err bitreich.org 70
i-TODO Err bitreich.org 70
i- Err bitreich.org 70
i-References: Err bitreich.org 70
i - https://www.gnu.org/prep/standards/standards.html#DESTDIR Err bitreich.org 70
i - https://nullprogram.com/blog/2017/08/20/ Err bitreich.org 70
i- Err bitreich.org 70
i-- https://www.openbsd.org/faq/ports/ Err bitreich.org 70
i+- https://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html Err bitreich.org 70
i+- https://pubs.opengroup.org/onlinepubs/9699919799/ Err bitreich.org 70
.
Response:
text/plain