aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile63
1 files changed, 63 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..2bcc82e
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,63 @@
+include config.mk
+
+SRC += vis.c colors.c editor.c text.c
+OBJ = ${SRC:.c=.o}
+
+all: clean options vis
+
+options:
+ @echo vis build options:
+ @echo "CFLAGS = ${CFLAGS}"
+ @echo "LDFLAGS = ${LDFLAGS}"
+ @echo "CC = ${CC}"
+
+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
+
+vis: ${OBJ}
+ @echo CC -o $@
+ @${CC} -o $@ ${OBJ} ${LDFLAGS}
+ @ln -sf $@ nano
+
+debug: clean
+ @make CFLAGS='${DEBUG_CFLAGS}'
+
+clean:
+ @echo cleaning
+ @rm -f vis nano ${OBJ} vis-${VERSION}.tar.gz
+
+dist: clean
+ @echo creating dist tarball
+ @mkdir -p vis-${VERSION}
+ @cp -R LICENSE Makefile README config.def.h config.mk \
+ ${SRC} editor.h text.h util.h vis.1 vis-${VERSION}
+ @tar -cf vis-${VERSION}.tar vis-${VERSION}
+ @gzip vis-${VERSION}.tar
+ @rm -rf vis-${VERSION}
+
+install: vis
+ @echo stripping executable
+ @strip -s vis
+ @echo installing executable file to ${DESTDIR}${PREFIX}/bin
+ @mkdir -p ${DESTDIR}${PREFIX}/bin
+ @cp -f vis ${DESTDIR}${PREFIX}/bin
+ @chmod 755 ${DESTDIR}${PREFIX}/bin/vis
+ @echo installing manual page to ${DESTDIR}${MANPREFIX}/man1
+ @mkdir -p ${DESTDIR}${MANPREFIX}/man1
+ @sed "s/VERSION/${VERSION}/g" < vis.1 > ${DESTDIR}${MANPREFIX}/man1/vis.1
+ @chmod 644 ${DESTDIR}${MANPREFIX}/man1/vis.1
+
+uninstall:
+ @echo removing executable file from ${DESTDIR}${PREFIX}/bin
+ @rm -f ${DESTDIR}${PREFIX}/bin/vis
+ @echo removing manual page from ${DESTDIR}${MANPREFIX}/man1
+ @rm -f ${DESTDIR}${MANPREFIX}/man1/vis.1
+
+.PHONY: all options clean dist install uninstall debug