sltar

a simple tar implementation
git clone git://git.suckless.org/sltar
Log | Files | Refs | LICENSE

Makefile (1466B)


      1 # sltar - suckless tar
      2 # (c) 2007 Enno Boland
      3 
      4 include config.mk
      5 
      6 SRC = sltar.c
      7 OBJ = ${SRC:.c=.o}
      8 TARGET = sltar
      9 
     10 all: options ${TARGET}
     11 
     12 options:
     13 	@echo ${TARGET} build options:
     14 	@echo "CFLAGS   = ${CFLAGS}"
     15 	@echo "LDFLAGS  = ${LDFLAGS}"
     16 	@echo "CC       = ${CC}"
     17 
     18 ${OBJ}: config.mk
     19 
     20 %.o: %.c
     21 	@echo CC $@
     22 	@${CC} -c ${CFLAGS} $<
     23 
     24 ${TARGET}: ${OBJ}
     25 	@echo CC -o $@
     26 	@${CC} -o $@ ${OBJ} ${LDFLAGS}
     27 
     28 clean:
     29 	@echo cleaning
     30 	@rm -f -- ${OBJ} ${TARGET} ${TARGET}-${VERSION}.tar.gz
     31 
     32 dist: sltar
     33 	@echo creating dist tarball
     34 	@mkdir -p ${TARGET}-${VERSION}
     35 	@cp -R LICENSE Makefile config.mk \
     36 		${TARGET}.1 ${SRC} ${TARGET}-${VERSION}
     37 	@./sltar c ${TARGET}-${VERSION} > ${TARGET}-${VERSION}.tar
     38 	@gzip ${TARGET}-${VERSION}.tar
     39 	@rm -rf ${TARGET}-${VERSION}
     40 
     41 install: all
     42 	@echo installing executable file to ${DESTDIR}${PREFIX}/bin
     43 	@mkdir -p ${DESTDIR}${PREFIX}/bin
     44 	@cp -f ${TARGET} ${DESTDIR}${PREFIX}/bin
     45 	@chmod 755 ${DESTDIR}${PREFIX}/bin/${TARGET}
     46 	@echo installing manual page to ${DESTDIR}${MANPREFIX}/man1
     47 	@mkdir -p ${DESTDIR}${MANPREFIX}/man1
     48 	@sed "s/VERSION/${VERSION}/g" < ${TARGET}.1 > ${DESTDIR}${MANPREFIX}/man1/${TARGET}.1
     49 	@chmod 644 ${DESTDIR}${MANPREFIX}/man1/${TARGET}.1
     50 
     51 uninstall:
     52 	@echo removing executable file from ${DESTDIR}${PREFIX}/bin
     53 	@rm -f ${DESTDIR}${PREFIX}/bin/${TARGET}
     54 	@echo removing manual page from ${DESTDIR}${MANPREFIX}/man1
     55 	@rm -f ${DESTDIR}${MANPREFIX}/man1/${TARGET}.1
     56 
     57 .PHONY: all options clean dist install uninstall