Makefile: simplify, respect system flags - smu - smu - simple markup (Markdown) processor (fork, fixes + features)
 (HTM) git clone git://git.codemadness.org/smu
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 9f36d5824c364b655100d211cf156e7c580464c4
 (DIR) parent b4bfba10cb2c000c39249228fcf6286831484a66
 (HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
       Date:   Tue, 11 May 2021 01:43:44 +0200
       
       Makefile: simplify, respect system flags
       
       Diffstat:
         M Makefile                            |      63 +++++++++++++------------------
         D config.mk                           |      20 --------------------
       
       2 files changed, 27 insertions(+), 56 deletions(-)
       ---
 (DIR) diff --git a/Makefile b/Makefile
       @@ -1,55 +1,46 @@
       -# libsmu - simple markup
       -# (c) 2007, 2008 Enno Boland
       +VERSION = 1.5
        
       -include config.mk
       +# paths
       +PREFIX = /usr/local
       +MANPREFIX = ${PREFIX}/share/man
       +
       +# flags
       +SMU_CFLAGS = -DVERSION=\"${VERSION}\" ${CFLAGS}
       +SMU_LDFLAGS = ${LDFLAGS}
        
        SRC    = smu.c
        OBJ    = ${SRC:.c=.o}
        
       -all: options smu
       -
       -options:
       -        @echo smu build options:
       -        @echo "CFLAGS   = ${CFLAGS}"
       -        @echo "LDFLAGS  = ${LDFLAGS}"
       -        @echo "CC       = ${CC}"
       +all: smu
        
        .c.o:
       -        @echo CC $<
       -        @${CC} -c ${CFLAGS} $<
       +        ${CC} -c ${SMU_CFLAGS} $<
        
       -${OBJ}: config.mk
       +${OBJ}:
        
        smu: ${OBJ}
       -        @echo LD $@
       -        @${CC} -o $@ ${OBJ} ${LDFLAGS}
       +        ${CC} -o $@ ${OBJ} ${SMU_LDFLAGS}
        
        clean:
       -        @echo cleaning
       -        @rm -f smu ${OBJ} ${LIBOBJ} smu-${VERSION}.tar.gz
       +        rm -f smu ${OBJ} ${LIBOBJ} smu-${VERSION}.tar.gz
        
        dist: clean
       -        @echo creating dist tarball
       -        @mkdir -p smu-${VERSION}
       -        @cp -R LICENSE Makefile config.mk smu.1 ${SRC} smu-${VERSION}
       -        @tar -cf smu-${VERSION}.tar smu-${VERSION}
       -        @gzip smu-${VERSION}.tar
       -        @rm -rf smu-${VERSION}
       +        mkdir -p smu-${VERSION}
       +        cp -R LICENSE Makefile smu.1 ${SRC} smu-${VERSION}
       +        tar -cf smu-${VERSION}.tar smu-${VERSION}
       +        gzip smu-${VERSION}.tar
       +        rm -rf smu-${VERSION}
        
        install: all
       -        @echo installing executable file to ${DESTDIR}${PREFIX}/bin
       -        @mkdir -p ${DESTDIR}${PREFIX}/bin
       -        @cp -f smu ${DESTDIR}${PREFIX}/bin
       -        @chmod 755 ${DESTDIR}${PREFIX}/bin/smu
       -        @echo installing manual page to ${DESTDIR}${MANPREFIX}/man1
       -        @mkdir -p ${DESTDIR}${MANPREFIX}/man1
       -        @sed "s/VERSION/${VERSION}/g" < smu.1 > ${DESTDIR}${MANPREFIX}/man1/smu.1
       -        @chmod 644 ${DESTDIR}${MANPREFIX}/man1/smu.1
       +        mkdir -p ${DESTDIR}${PREFIX}/bin
       +        cp -f smu ${DESTDIR}${PREFIX}/bin
       +        chmod 755 ${DESTDIR}${PREFIX}/bin/smu
       +        mkdir -p ${DESTDIR}${MANPREFIX}/man1
       +        sed "s/VERSION/${VERSION}/g" < smu.1 > ${DESTDIR}${MANPREFIX}/man1/smu.1
       +        chmod 644 ${DESTDIR}${MANPREFIX}/man1/smu.1
        
        uninstall:
       -        @echo removing executable file from ${DESTDIR}${PREFIX}/bin
       -        @rm -f ${DESTDIR}${PREFIX}/bin/smu
       -        @echo removing manual page from ${DESTDIR}${MANPREFIX}/man1
       -        @rm -f ${DESTDIR}${MANPREFIX}/man1/smu.1
       +        rm -f ${DESTDIR}${PREFIX}/bin/smu \
       +                ${DESTDIR}${MANPREFIX}/man1/smu.1
        
       -.PHONY: all options clean dist install uninstall
       +.PHONY: all clean dist install uninstall
 (DIR) diff --git a/config.mk b/config.mk
       @@ -1,20 +0,0 @@
       -# smu version
       -VERSION = 1.5
       -
       -# paths
       -PREFIX = /usr/local
       -MANPREFIX = ${PREFIX}/share/man
       -
       -# includes and libs
       -INCS = -I. -I/usr/include
       -LIBS = -L/usr/lib
       -
       -# flags
       -CFLAGS = -g -O0 -Wall -Werror -ansi ${INCS} -DVERSION=\"${VERSION}\"
       -#CFLAGS = -fprofile-arcs -ftest-coverage -pg -g -O0 -Wall -Werror -ansi ${INCS} -DVERSION=\"${VERSION}\"
       -#CFLAGS = -Os -Wall -Werror -ansi ${INCS} -DVERSION=\"${VERSION}\"
       -#LDFLAGS = -fprofile-arcs -ftest-coverage -pg ${LIBS}
       -LDFLAGS = ${LIBS}
       -
       -# compiler
       -CC = cc