Makefile 575 B

12345678910111213141516171819202122232425262728293031323334353637
  1. .POSIX: ;
  2. .SILENT: ;
  3. include config.mk
  4. NAME = map1
  5. OBJS = src/main.o
  6. default: flags bin/${NAME}
  7. all: flags bin/${NAME}
  8. flags:
  9. @echo ${NAME} 'build options:'
  10. @echo 'CC =' ${CC}
  11. @echo 'CPPFLAGS =' ${CPPFLAGS}
  12. @echo 'CFLAGS =' ${CFLAGS}
  13. @echo 'LDFLAGS =' ${LDFLAGS}
  14. ${OBJS}: config.mk Makefile
  15. .c.o:
  16. @echo compiling $<
  17. ${CC} ${CFLAGS} ${CPPFLAGS} -c $< -o $@
  18. bin/${NAME}: ${OBJS}
  19. @echo linking $@
  20. ${CC} ${CFLAGS} ${LDFLAGS} ${OBJS} -o $@
  21. clean:
  22. @echo cleaning
  23. rm -r src/*.o bin/${NAME}
  24. fresh: clean flags all
  25. .PHONY: default all flags clean fresh