Makefile 1000 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # libspngstream - simple png manipulation lib
  2. CFLAGS:= -Wall -Werror -fpic -std=c99 -pedantic
  3. CXX:= gcc
  4. LIB:= libspngstream.so
  5. PREFIX:= /usr/local
  6. LDFLAGS:=
  7. LDFLAGS+= -l m
  8. LDFLAGS+= -l png
  9. OBJ:= armath.o readpng.o writepng.o libspngstream.o
  10. HEA:= $(OBJ:.o=.h) def.h
  11. all: $(LIB)
  12. %.o: src/%.c src/%.h src/def.h
  13. $(CXX) $(CFLAGS) -c $<
  14. $(LIB): $(OBJ)
  15. $(CXX) -shared -o $(LIB) $(OBJ) $(LDFLAGS)
  16. rm *.o
  17. install: all
  18. @mkdir -p ${DESTDIR}${PREFIX}/
  19. @echo installing header files to ${DESTDIR}${PREFIX}/include
  20. @cp -f src/*.h ${DESTDIR}${PREFIX}/include
  21. @echo installing shared library to ${DESTDIR}${PREFIX}/lib
  22. @cp -f ${LIB} ${DESTDIR}${PREFIX}/lib
  23. @chmod 755 ${DESTDIR}${PREFIX}/lib/${LIB}
  24. uninstall:
  25. @echo removing header files from ${DESTDIR}${PREFIX}/include
  26. @rm -f $(addprefix ${DESTDIR}${PREFIX}/include/, $(HEA))
  27. @echo removing shared object from ${DESTDIR}${PREFIX}/lib
  28. @rm -f ${LIB} ${DESTDIR}${PREFIX}/lib/${LIB}
  29. clean:
  30. rm -f $(LIB) *.o
  31. .PHONY: all clean install uninstall