diff options
author | Mattias Andrée <maandree@kth.se> | 2016-08-06 19:16:11 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2016-08-06 19:16:11 +0200 |
commit | 6cf6565622343bc33b8a969aaa0d8881500ec6a9 (patch) | |
tree | 0d76a2841ca753bacc074a0eaff36fb39d6c9085 /Makefile | |
parent | Use MSG_NOSIGNAL when sending (diff) | |
download | coopgammad-1.0.tar.gz coopgammad-1.0.tar.bz2 coopgammad-1.0.tar.xz |
Add install rules to makefile1.0
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 77 |
1 files changed, 65 insertions, 12 deletions
@@ -1,3 +1,10 @@ +PREFIX = /usr +BINDIR = $(PREFIX)/bin +DATADIR = $(PREFIX)/share +MANDIR = $(DATADIR)/man +MAN1DIR = $(MANDIR)/man1 +LICENSEDIR = $(DATADIR)/licenses + PKGNAME = coopgammad COMMAND = coopgammad @@ -19,19 +26,9 @@ SRC = \ types/message \ types/ring -OPTIMISE = -Og -g - -WARN = -Wall -Wextra -pedantic -Wdouble-promotion -Wformat=2 -Winit-self -Wmissing-include-dirs \ - -Wtrampolines -Wfloat-equal -Wshadow -Wmissing-prototypes -Wmissing-declarations \ - -Wredundant-decls -Wnested-externs -Winline -Wno-variadic-macros -Wsync-nand \ - -Wunsafe-loop-optimizations -Wcast-align -Wstrict-overflow -Wdeclaration-after-statement \ - -Wundef -Wbad-function-cast -Wcast-qual -Wwrite-strings -Wlogical-op -Waggregate-return \ - -Wstrict-prototypes -Wold-style-definition -Wpacked -Wvector-operation-performance \ - -Wunsuffixed-float-constants -Wsuggest-attribute=const -Wsuggest-attribute=noreturn \ - -Wsuggest-attribute=pure -Wsuggest-attribute=format -Wnormalized=nfkc -Wconversion +OPTIMISE = -O2 -FFLAGS = -fstrict-aliasing -fstrict-overflow -fipa-pure-const -ftree-vrp -fstack-usage \ - -funsafe-loop-optimizations +WARN = -Wall -Wextra -pedantic CPP_linux = -DHAVE_LINUX_PROCFS CPP_linux-libre = $(CPP_linux) @@ -44,9 +41,16 @@ CPPFLAGS += -DUSE_VALGRIND endif + .PHONY: all all: bin/coopgammad +.PHONY: base +base: cmd + +.PHONY: cmd +cmd: bin/coopgammad + bin/coopgammad: $(foreach S,$(SRC),obj/$(S).o) @mkdir -p -- "$$(dirname -- "$@")" $(CC) $(LDFLAGS) -o $@ $^ @@ -56,6 +60,55 @@ obj/%.o: src/%.c src/*.h src/*/*.h $(CC) $(CCFLAGS) $(CPPFLAGS) -c -o $@ $< + +.PHONY: install +install: install-base install-doc + +.PHONY: install-base +install-base: install-cmd install-copyright + +.PHONY: install-copyright +install-copyright: install-license install-copying + +.PHONY: install-doc +install-doc: install-man + +.PHONY: install-cmd +install-cmd: bin/coopgammad + mkdir -p -- "$(DESTDIR)$(BINDIR)" + cp -- bin/coopgammad "$(DESTDIR)$(BINDIR)/$(COMMAND)" + chmod 0755 -- "$(DESTDIR)$(BINDIR)/$(COMMAND)" + +.PHONY: install-license +install-license: + mkdir -p -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)" + cp -- LICENSE "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/LICENSE" + chmod 0644 -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/LICENSE" + +.PHONY: install-copying +install-copying: + mkdir -p -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)" + cp -- COPYING "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/COPYING" + chmod 0644 -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/COPYING" + +.PHONY: install-man +install-man: + mkdir -p -- "$(DESTDIR)$(MAN1DIR)" + cp -- doc/coopgammad.1 "$(DESTDIR)$(MAN1DIR)/$(COMMAND).1" + chmod 644 -- "$(DESTDIR)$(MAN1DIR)/$(COMMAND).1" + + + +.PHONY: uninstall +uninstall: + -rm -- "$(DESTDIR)$(MAN1DIR)/$(COMMAND).1" + -rm -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/COPYING" + -rm -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/LICENSE" + -rmdir -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)" + -rm -- "$(DESTDIR)$(BINDIR)/$(COMMAND)" + + + .PHONY: clean clean: -rm -r bin obj |