From 6f53d329beca478d60f6e575918d73eb9cf1214f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Wed, 14 Jan 2015 12:18:28 +0100 Subject: Simplify Makefile Use $CC *.c -o vis to enable global link time optimization. This also fixes issues with parallel builds. config.h is no longer symlinked to config.def.h which allows local modifications. --- Makefile | 34 +++++++++------------------------- 1 file changed, 9 insertions(+), 25 deletions(-) diff --git a/Makefile b/Makefile index 7689e4f..88c57a9 100644 --- a/Makefile +++ b/Makefile @@ -1,32 +1,15 @@ include config.mk -SRC = editor.c window.c text.c text-motions.c text-objects.c register.c buffer.c ring-buffer.c -HDR := ${SRC:.c=.h} macro.h syntax.h util.h config.def.h -SRC += vis.c -OBJ = ${SRC:.c=.o} -ALL = ${SRC} ${HDR} config.mk Makefile LICENSE README vis.1 +ALL = *.c *.h config.mk Makefile LICENSE README vis.1 -all: clean options vis - -options: - @echo vis build options: - @echo "CFLAGS = ${CFLAGS}" - @echo "LDFLAGS = ${LDFLAGS}" - @echo "CC = ${CC}" +all: vis config.h: -#TODO cp config.def.h config.h - ln -fs config.def.h config.h - -.c.o: - @echo CC $< - @${CC} -c ${CFLAGS} $< - -${OBJ}: config.h config.mk + cp config.def.h config.h -vis: ${OBJ} - @echo CC -o $@ - @${CC} -o $@ ${OBJ} ${LDFLAGS} +vis: config.h config.mk + @echo ${CC} ${CFLAGS} ${LDFLAGS} *.c -o $@ + @${CC} ${CFLAGS} ${LDFLAGS} *.c -o $@ @ln -sf $@ nano debug: clean @@ -34,12 +17,13 @@ debug: clean clean: @echo cleaning - @rm -f vis nano ${OBJ} vis-${VERSION}.tar.gz + @rm -f vis nano vis-${VERSION}.tar.gz dist: clean @echo creating dist tarball @mkdir -p vis-${VERSION} @cp -R ${ALL} vis-${VERSION} + @rm -f vis-${VERSION}/config.h @tar -cf vis-${VERSION}.tar vis-${VERSION} @gzip vis-${VERSION}.tar @rm -rf vis-${VERSION} @@ -62,4 +46,4 @@ uninstall: @echo removing manual page from ${DESTDIR}${MANPREFIX}/man1 @rm -f ${DESTDIR}${MANPREFIX}/man1/vis.1 -.PHONY: all options clean dist install uninstall debug +.PHONY: all vis clean dist install uninstall debug -- cgit v1.2.3