GNUmakefile 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. DESTDIR ?=
  2. PREFIX ?= /usr
  3. COMPRESS_MAN ?= yes
  4. STRIP_BINARY ?= yes
  5. EXAMPLES ?= yes
  6. CSECFLAGS ?= -fstack-protector-all -Wall --param ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -fstack-check -DPARANOID -std=gnu99
  7. CFLAGS ?= -pipe -O2
  8. CFLAGS += $(CSECFLAGS) $(shell pkg-config --cflags gtk+-2.0) -flto
  9. DEBUGCFLAGS ?= -pipe -Wall -Werror -ggdb3 -export-dynamic -Wno-error=unused-variable -O0 -pipe $(CSECFLAGS) $(shell pkg-config --cflags gtk+-2.0)
  10. CARCHFLAGS ?= -march=native
  11. LIBS := -lm $(shell pkg-config --libs gtk+-2.0)
  12. LDSECFLAGS ?= -Xlinker -zrelro
  13. LDFLAGS += $(LDSECFLAGS) -pthread -flto
  14. INC := $(INC)
  15. INSTDIR = $(DESTDIR)$(PREFIX)
  16. objs=\
  17. pthreadex.o\
  18. binary.o\
  19. error.o\
  20. malloc.o\
  21. main.o\
  22. binary=voltlogger_oscilloscope
  23. .PHONY: doc
  24. all: $(objs)
  25. $(CC) $(CARCHFLAGS) $(CFLAGS) $(LDFLAGS) $(objs) $(LIBS) -o $(binary)
  26. %.o: %.c
  27. $(CC) $(CARCHFLAGS) $(CFLAGS) $(INC) $< -c -o $@
  28. debug:
  29. $(CC) $(CARCHFLAGS) -D_DEBUG_SUPPORT $(DEBUGCFLAGS) $(INC) $(LDFLAGS) *.c $(LIBS) -o $(binary)
  30. clean:
  31. rm -f $(binary) *.o
  32. distclean: clean
  33. doc:
  34. doxygen .doxygen
  35. install:
  36. install -d "$(INSTDIR)/bin" "$(INSTDIR)/share/man/man1"
  37. ifeq ($(STRIP_BINARY),yes)
  38. strip --strip-unneeded -R .comment -R .GCC.command.line -R .note.gnu.gold-version $(binary)
  39. endif
  40. install -m 755 $(binary) "$(INSTDIR)"/bin/
  41. install -m 644 man/man1/voltlogger_oscilloscope.1 "$(INSTDIR)"/share/man/man1/
  42. ifeq ($(COMPRESS_MAN),yes)
  43. rm -f "$(INSTDIR)"/share/man/man1/voltlogger_oscilloscope.1.gz
  44. gzip "$(INSTDIR)"/share/man/man1/voltlogger_oscilloscope.1
  45. endif
  46. deinstall:
  47. rm -f "$(INSTDIR)"/bin/$(binary)