makefile 564 B

1234567891011121314151617181920212223242526
  1. PROJECT_NAME=ddcglut
  2. SRC=$(wildcard src/*.c)
  3. OBJ=${SRC:src/%.c=src/%.o}
  4. HEADERS=$(wildcard include/*.h)
  5. COMPILER_FLAGS=-Wall -Werror -Wpedantic
  6. STATIC_OUT=lib${PROJECT_NAME}.a
  7. PREFIX=/usr
  8. # create library
  9. ${STATIC_OUT}: ${OBJ}
  10. ar rcs $@ $^
  11. # compile source files to object files
  12. %.o: %.c ${HEADERS}
  13. ${CC} ${COMPILER_FLAGS} -Iinclude -DDD_PLATFORM_NATIVE -o $@ -c ${@:%.o=%.c}
  14. # install library
  15. install: ${STATIC_OUT}
  16. mkdir -p ${PREFIX}/include
  17. install -m644 ${HEADERS} ${PREFIX}/include
  18. mkdir -p ${PREFIX}/lib
  19. install -m755 ${STATIC_OUT} ${PREFIX}/lib