Source

srw / Makefile

Full commit
Evan Gates c06f2dd 




















































# srw - simple read wrapper

include config.mk

SRC = srw.c
OBJ = ${SRC:.c=.o}

all: options srw

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

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

${OBJ}: config.mk

srw: ${OBJ}
	@echo CC -o $@
	@${CC} -o $@ ${OBJ} ${LDFLAGS}

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

dist: clean
	@echo creating dist tarball
	@mkdir -p srw-${VERSION}
	@cp -R LICENSE Makefile README config.mk srw.1 ${SRC} srw-${VERSION}
	@tar -cf srw-${VERSION}.tar srw-${VERSION}
	@gzip srw-${VERSION}.tar
	@rm -rf srw-${VERSION}

install: all
	@echo installing executable file to ${DESTDIR}${PREFIX}/bin
	@mkdir -p ${DESTDIR}${PREFIX}/bin
	@cp -f srw ${DESTDIR}${PREFIX}/bin
	@chmod 755 ${DESTDIR}${PREFIX}/bin/srw
	@echo installing manual page to ${DESTDIR}${MANPREFIX}/man1
	@mkdir -p ${DESTDIR}${MANPREFIX}/man1
	@sed "s/VERSION/${VERSION}/g" < srw.1 > ${DESTDIR}${MANPREFIX}/man1/srw.1
	@chmod 644 ${DESTDIR}${MANPREFIX}/man1/srw.1

uninstall:
	@echo removing executable file from ${DESTDIR}${PREFIX}/bin
	@rm -f ${DESTDIR}${PREFIX}/bin/srw
	@echo removing manual page from ${DESTDIR}${MANPREFIX}/man1
	@rm -f ${DESTDIR}${MANPREFIX}/man1/srw.1

.PHONY: all options clean dist install uninstall