Makefile 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # See LICENSE file for copyright and license details.
  2. include config.mk
  3. SRC = ${NAME}.c
  4. OBJ = ${SRC:.c=.o}
  5. all: options ${NAME}
  6. options:
  7. @echo ${NAME} build options:
  8. @echo "CFLAGS = ${CFLAGS}"
  9. @echo "LDFLAGS = ${LDFLAGS}"
  10. @echo "CC = ${CC}"
  11. .c.o:
  12. @echo CC $<
  13. @${CC} -c ${CFLAGS} $<
  14. ${OBJ}: config.mk config.h
  15. ${NAME}: ${OBJ}
  16. @echo CC -o $@
  17. @${CC} -o $@ ${OBJ} ${LDFLAGS}
  18. config.h:
  19. @echo creating $@ from config.def.h
  20. @cp config.def.h $@
  21. clean:
  22. @echo cleaning
  23. @rm -f ${NAME} ${OBJ} ${NAME}-${VERSION}.tar.gz
  24. dist: clean
  25. @echo creating dist tarball
  26. @mkdir -p ${NAME}-${VERSION}
  27. @cp -R Makefile config.mk LICENSE config.def.h \
  28. ${SRC} ${NAME}-${VERSION}
  29. @tar -cf ${NAME}-${VERSION}.tar ${NAME}-${VERSION}
  30. @gzip ${NAME}-${VERSION}.tar
  31. @rm -rf ${NAME}-${VERSION}
  32. install: all
  33. @echo installing executable file to ${DESTDIR}${PREFIX}/bin
  34. @mkdir -p ${DESTDIR}${PREFIX}/bin
  35. @cp -f ${NAME} ${DESTDIR}${PREFIX}/bin
  36. @chmod 755 ${DESTDIR}${PREFIX}/bin/${NAME}
  37. uninstall:
  38. @echo removing executable file from ${DESTDIR}${PREFIX}/bin
  39. @rm -f ${DESTDIR}${PREFIX}/bin/${NAME}
  40. .PHONY: all options clean dist install uninstall