Introduction
Introduction Statistics Contact Development Disclaimer Help
Makefile improvements - sic - simple irc client
git clone git://git.suckless.org/sic
Log
Files
Refs
README
LICENSE
---
commit f2c5daa9fe8ee9da89b9596c2b316ba7f9bd64a7
parent 81533f966ec31049c6159eac482bb821cb1e54ef
Author: Hiltjo Posthuma <[email protected]>
Date: Thu, 6 May 2021 01:39:46 +0200
Makefile improvements
- Respect system/port flags by default.
- Be verbose and do not hide output. This makes it easier to debug a build.
- Remove the "options" target.
- Remove config.mk: just edit the Makefile or override flags if needed.
- dist: no need to clean before packaging files.
- dist: pipe directly to gzip without an intermediate tarball file.
- Define and add a POSIX marker to the Makefile.
Diffstat:
M Makefile | 83 ++++++++++++++++-------------…
M README | 7 ++++---
D config.mk | 20 --------------------
3 files changed, 46 insertions(+), 64 deletions(-)
---
diff --git a/Makefile b/Makefile
@@ -1,58 +1,59 @@
-# sic - simple irc client
+.POSIX:
-include config.mk
+NAME = sic
+VERSION = 1.3
-SRC = sic.c
+# paths
+PREFIX = /usr/local
+MANPREFIX = ${PREFIX}/share/man
+
+# use system flags.
+SIC_CFLAGS = ${CFLAGS}
+SIC_LDFLAGS = ${LDFLAGS}
+SIC_CPPFLAGS = ${LDFLAGS} -DVERSION=\"${VERSION}\" -D_GNU_SOURCE
+
+BIN = sic
+SRC = ${BIN:=.c}
OBJ = ${SRC:.c=.o}
+MAN1 = ${BIN:=.1}
-all: options sic
+all: ${BIN}
-options:
- @echo sic build options:
- @echo "CFLAGS = ${CFLAGS}"
- @echo "LDFLAGS = ${LDFLAGS}"
- @echo "CC = ${CC}"
+${BIN}: ${@:=.o}
-.c.o:
- @echo CC $<
- @${CC} -c ${CFLAGS} $<
+${OBJ}: config.h strlcpy.c util.c
-${OBJ}: config.h config.mk strlcpy.c util.c
+.o:
+ ${CC} -o $@ $< ${SIC_LDFLAGS}
-config.h:
- @echo creating $@ from config.def.h
- @cp config.def.h $@
+.c.o:
+ ${CC} -c ${SIC_CFLAGS} ${SIC_CPPFLAGS} -o $@ -c $<
-sic: ${OBJ}
- @echo CC -o $@
- @${CC} -o $@ ${OBJ} ${LDFLAGS}
+config.h:
+ cp config.def.h $@
clean:
- @echo cleaning
- @rm -f sic ${OBJ} sic-${VERSION}.tar.gz
+ rm -f ${BIN} ${OBJ} "${NAME}-${VERSION}.tar.gz"
-dist: clean
- @echo creating dist tarball
- @mkdir -p sic-${VERSION}
- @cp -R LICENSE Makefile README arg.h config.def.h config.mk sic.1 sic.…
- @tar -cf sic-${VERSION}.tar sic-${VERSION}
- @gzip sic-${VERSION}.tar
- @rm -rf sic-${VERSION}
+dist:
+ mkdir -p "${NAME}-${VERSION}"
+ cp -fR LICENSE Makefile README arg.h config.def.h \
+ ${MAN1} ${SRC} util.c strlcpy.c "${NAME}-${VERSION}"
+ tar -cf - "${NAME}-${VERSION}" | \
+ gzip -c > "${NAME}-${VERSION}.tar.gz"
+ rm -rf "${NAME}-${VERSION}"
install: all
- @echo installing executable file to ${DESTDIR}${PREFIX}/bin
- @mkdir -p ${DESTDIR}${PREFIX}/bin
- @cp -f sic ${DESTDIR}${PREFIX}/bin
- @chmod 755 ${DESTDIR}${PREFIX}/bin/sic
- @echo installing manual page to ${DESTDIR}${MANPREFIX}/man1
- @mkdir -p ${DESTDIR}${MANPREFIX}/man1
- @sed "s/VERSION/${VERSION}/g" < sic.1 > ${DESTDIR}${MANPREFIX}/man1/si…
- @chmod 644 ${DESTDIR}${MANPREFIX}/man1/sic.1
+ mkdir -p ${DESTDIR}${PREFIX}/bin
+ cp -f ${BIN} "${DESTDIR}${PREFIX}/bin"
+ chmod 755 "${DESTDIR}${PREFIX}/bin/${BIN}"
+ mkdir -p "${DESTDIR}${MANPREFIX}/man1"
+ sed "s/VERSION/${VERSION}/g" < ${MAN1} > "${DESTDIR}${MANPREFIX}/man1/…
+ chmod 644 "${DESTDIR}${MANPREFIX}/man1/${MAN1}"
uninstall:
- @echo removing executable file from ${DESTDIR}${PREFIX}/bin
- @rm -f ${DESTDIR}${PREFIX}/bin/sic
- @echo removing manual page from ${DESTDIR}${MANPREFIX}/man1
- @rm -f ${DESTDIR}${MANPREFIX}/man1/sic.1
+ rm -f \
+ "${DESTDIR}${PREFIX}/bin/${BIN}"\
+ "${DESTDIR}${MANPREFIX}/man1/${MAN1}"
-.PHONY: all options clean dist install uninstall
+.PHONY: all clean dist install uninstall
diff --git a/README b/README
@@ -8,13 +8,14 @@ different channel buffers, that's actually a feature.
Installation
------------
-Edit config.mk to match your local setup. sic is installed into
-/usr/local by default.
+Edit the Makefile or override the flags to match your local setup. sic is
+installed into /usr/local by default.
Afterwards enter the following command to build and install sic
(if necessary as root):
- $ make clean install
+ $ make
+ # make install
Running sic
diff --git a/config.mk b/config.mk
@@ -1,20 +0,0 @@
-# sic version
-VERSION = 1.3
-
-# Customize below to fit your system
-
-# paths
-PREFIX = /usr/local
-MANPREFIX = ${PREFIX}/share/man
-
-# includes and libs
-INCS = -I. -I/usr/include
-LIBS = -L/usr/lib -lc
-
-# flags
-CPPFLAGS = -DVERSION=\"${VERSION}\" -D_GNU_SOURCE
-CFLAGS = -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS}
-LDFLAGS = -s ${LIBS}
-
-# compiler and linker
-CC = cc
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.