Makefile 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. # See LICENSE file for copyright and license details.
  2. include config.mk
  3. SRC = rid_hex.c
  4. OBJ = $(SRC:.c=.o)
  5. LIB = librid_hex.a
  6. INC = rid_hex.h
  7. .PHONY: all install uninstall clean
  8. PKG_STR = "\nIf this is a local install you may need to run:\n\t\
  9. \"export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig\" \nto use this library.\n"
  10. all: $(LIB) rid_hex.3.gz
  11. $(LIB): $(OBJ)
  12. @$(AR) -rcs $@ $(OBJ)
  13. .c.o:
  14. @$(CC) $(CFLAGS) -c $<
  15. rid_hex.3.gz: rid_hex.3
  16. @gzip -k rid_hex.3
  17. install: $(LIB) $(INC) rid_hex.3.gz rid_hex.pc
  18. @echo @ install librid_hex to $(PREFIX)
  19. @mkdir -p $(PREFIX)/lib
  20. @cp $(LIB) $(PREFIX)/lib/
  21. @echo @ install rid_hex.h to $(PREFIX)
  22. @mkdir -p $(PREFIX)/include
  23. @cp $(INC) $(PREFIX)/include/
  24. @echo @ install rid_hex.3 to $(PREFIX)
  25. @mkdir -p $(PREFIX)/share/man/man3
  26. @cp rid_hex.3.gz $(PREFIX)/share/man/man3/
  27. @mandb -q -p
  28. @echo @ install rid_hex.pc to $(PREFIX)
  29. @printf $(PKG_STR)
  30. @mkdir -p $(PREFIX)/lib/pkgconfig
  31. @cp rid_hex.pc $(PREFIX)/lib/pkgconfig/
  32. uninstall:
  33. @echo @ uninstall rid_hex from $(PREFIX)
  34. @rm -f $(PREFIX)/lib/$(LIB)
  35. @rm -f $(PREFIX)/include/$(INC)
  36. @rm -f $(PREFIX)/share/man/man3/rid_hex.3.gz
  37. @rm -f $(PREFIX)/lib/pkgconfig/rid_hex.pc
  38. clean:
  39. @rm -f $(LIB) $(OBJ) rid_hex.3.gz