Skip to content

Commit

Permalink
Simplify Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
martanne committed Jan 3, 2017
1 parent 85666f0 commit 891f275
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 38 deletions.
41 changes: 11 additions & 30 deletions Makefile
@@ -1,51 +1,32 @@
include config.mk

SRC = dvtm.c vt.c
OBJ = ${SRC:.c=.o}
BIN = dvtm dvtm-status dvtm-pager

all: clean options dvtm
VERSION = $(shell git describe --always --dirty 2>/dev/null || echo "0.15-git")
CFLAGS += -DVERSION=\"${VERSION}\"
DEBUG_CFLAGS = ${CFLAGS} -UNDEBUG -O0 -g -ggdb -Wall -Wextra -Wno-unused-parameter

options:
@echo dvtm build options:
@echo "CFLAGS = ${CFLAGS}"
@echo "LDFLAGS = ${LDFLAGS}"
@echo "CC = ${CC}"
all: dvtm

config.h:
cp config.def.h config.h

.c.o:
@echo CC $<
@${CC} -c ${CFLAGS} $<

${OBJ}: config.h config.mk

dvtm: ${OBJ}
@echo CC -o $@
@${CC} -o $@ ${OBJ} ${LDFLAGS}
dvtm: config.h config.mk *.c *.h
${CC} ${CFLAGS} ${SRC} ${LDFLAGS} ${LIBS} -o $@

debug: clean
@make CFLAGS='${DEBUG_CFLAGS}'
@$(MAKE) CFLAGS='${DEBUG_CFLAGS}'

clean:
@echo cleaning
@rm -f dvtm ${OBJ} dvtm-${VERSION}.tar.gz
@rm -f dvtm

dist: clean
@echo creating dist tarball
@mkdir -p dvtm-${VERSION}
@cp -R LICENSE Makefile README.md testsuite.sh config.def.h config.mk \
${SRC} vt.h forkpty-aix.c forkpty-sunos.c tile.c bstack.c \
tstack.c vstack.c grid.c fullscreen.c fibonacci.c \
dvtm-status dvtm.info dvtm.1 dvtm-${VERSION}
@tar -cf dvtm-${VERSION}.tar dvtm-${VERSION}
@gzip dvtm-${VERSION}.tar
@rm -rf dvtm-${VERSION}
@git archive --prefix=dvtm-${VERSION}/ -o dvtm-${VERSION}.tar.gz HEAD

install: dvtm
@echo stripping executable
@${STRIP} dvtm
install: all
@mkdir -p ${DESTDIR}${PREFIX}/bin
@for b in ${BIN}; do \
echo "installing ${DESTDIR}${PREFIX}/bin/$$b"; \
Expand All @@ -67,4 +48,4 @@ uninstall:
@echo removing manual page from ${DESTDIR}${MANPREFIX}/man1
@rm -f ${DESTDIR}${MANPREFIX}/man1/dvtm.1

.PHONY: all options clean dist install uninstall debug
.PHONY: all clean dist install uninstall debug
9 changes: 1 addition & 8 deletions config.mk
@@ -1,6 +1,3 @@
# dvtm version
VERSION = 0.15

# Customize below to fit your system

PREFIX ?= /usr/local
Expand All @@ -12,10 +9,6 @@ TERMINFO := ${DESTDIR}${PREFIX}/share/terminfo
INCS = -I.
LIBS = -lc -lutil -lncursesw
CPPFLAGS = -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 -D_XOPEN_SOURCE_EXTENDED
CFLAGS += -std=c99 ${INCS} -DVERSION=\"${VERSION}\" -DNDEBUG ${CPPFLAGS}
LDFLAGS += ${LIBS}

DEBUG_CFLAGS = ${CFLAGS} -UNDEBUG -O0 -g -ggdb -Wall -Wextra -Wno-unused-parameter
CFLAGS += -std=c99 ${INCS} -DNDEBUG ${CPPFLAGS}

CC ?= cc
STRIP ?= strip

0 comments on commit 891f275

Please sign in to comment.