ii

irc it, simple FIFO based irc client
git clone git://git.suckless.org/ii
Log | Files | Refs | README | LICENSE

commit e32415744c0e7f2d75d4669addefc1b50f977cd6
parent 25ee995ead94f3343edee8aed797eea1140a6bfb
Author: Quentin Rameau <quinq@fifth.space>
Date:   Tue, 29 May 2018 18:27:36 +0200

Refactor Makefile

Declare it as POSIX-compliant
Use $() instead of ${}
Separate stock CFLAGS from user CFLAGS

Diffstat:
Makefile | 53++++++++++++++++++++++++++---------------------------
config.mk | 24+++++-------------------
2 files changed, 31 insertions(+), 46 deletions(-)

diff --git a/Makefile b/Makefile @@ -1,50 +1,49 @@ # See LICENSE file for copyright and license details. +.POSIX: + include config.mk SRC = ii.c strlcpy.c -OBJ = ${SRC:.c=.o} +OBJ = $(SRC:.c=.o) + +IICFLAGS = -DVERSION=\"$(VERSION)\" -D_DEFAULT_SOURCE $(CFLAGS) all: ii options: @echo ii build options: - @echo "CFLAGS = ${CFLAGS}" - @echo "LDFLAGS = ${LDFLAGS}" - @echo "CC = ${CC}" - -.o: - $(LD) -o $@ $< $(LDFLAGS) + @echo "CFLAGS = $(IICFLAGS)" + @echo "LDFLAGS = $(LDFLAGS)" + @echo "CC = $(CC)" .c.o: - $(CC) -c -o $@ $< $(CFLAGS) + $(CC) $(IICFLAGS) -c $< -ii: ${OBJ} - ${CC} -o $@ ${OBJ} ${LDFLAGS} +ii: $(OBJ) + $(CC) $(LDFLAGS) -o $@ $(OBJ) $(LIBS) -${OBJ}: arg.h +$(OBJ): arg.h install: all - mkdir -p ${DESTDIR}${DOCDIR} - mkdir -p ${DESTDIR}${BINDIR} - mkdir -p ${DESTDIR}${MAN1DIR} - install -d ${DESTDIR}${BINDIR} ${DESTDIR}${MAN1DIR} - install -m 644 CHANGES README FAQ LICENSE ${DESTDIR}${DOCDIR} - install -m 775 ii ${DESTDIR}${BINDIR} - sed "s/VERSION/${VERSION}/g" < ii.1 > ${DESTDIR}${MAN1DIR}/ii.1 - chmod 644 ${DESTDIR}${MAN1DIR}/ii.1 + mkdir -p $(DESTDIR)$(PREFIX)/bin + mkdir -p $(DESTDIR)$(MANPREFIX)/man1 + mkdir -p $(DESTDIR)$(DOCPREFIX)/ii + install -m 644 CHANGES README FAQ LICENSE $(DESTDIR)$(DOCPREFIX)/ii + install -m 775 ii $(DESTDIR)$(PREFIX)/bin + sed "s/VERSION/$(VERSION)/g" < ii.1 > $(DESTDIR)$(MANPREFIX)/man1/ii.1 + chmod 644 $(DESTDIR)$(MANPREFIX)/man1/ii.1 uninstall: all - rm -f ${DESTDIR}${MAN1DIR}/ii.1 \ - ${DESTDIR}${BINDIR}/ii - rm -rf ${DESTDIR}${DOCDIR} + rm -f $(DESTDIR)$(MANPREFIX)/man1/ii.1 $(DESTDIR)$(PREFIX)/bin/ii + rm -rf $(DESTDIR)$(DOCPREFIX)/ii dist: clean - mkdir -p ii-${VERSION} + mkdir -p ii-$(VERSION) cp -R Makefile CHANGES README FAQ LICENSE strlcpy.c arg.h \ - config.mk ii.c ii.1 ii-${VERSION} - tar -cf ii-${VERSION}.tar ii-${VERSION} - gzip ii-${VERSION}.tar - rm -rf ii-${VERSION} + config.mk ii.c ii.1 ii-$(VERSION) + tar -cf ii-$(VERSION).tar ii-$(VERSION) + gzip ii-$(VERSION).tar + rm -rf ii-$(VERSION) clean: rm -f ii *.o diff --git a/config.mk b/config.mk @@ -2,24 +2,10 @@ VERSION = 1.8 # paths -PREFIX = /usr/local -BINDIR = ${PREFIX}/bin -MANDIR = ${PREFIX}/share/man -MAN1DIR = ${MANDIR}/man1 -DOCDIR = ${PREFIX}/share/doc/ii +PREFIX = /usr/local +MANPREFIX = ${PREFIX}/share/man +DOCPREFIX = ${PREFIX}/share/doc -# includes and libs -INCLUDES = -I. -I/usr/include +CFLAGS = -Os +LDFLAGS = -s LIBS = - -# compiler -CC = cc - -# debug -#CFLAGS = -g -O0 -pedantic -Wall ${INCLUDES} -DVERSION=\"${VERSION}\" \ -# -std=c99 -D_DEFAULT_SOURCE -#LDFLAGS = ${LIBS} - -# release -CFLAGS = -Os ${INCLUDES} -DVERSION=\"${VERSION}\" -std=c99 -D_DEFAULT_SOURCE -LDFLAGS = -s ${LIBS}