GNUmakefile 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. # DT PS Tree
  2. #
  3. # Douglas Thrift
  4. #
  5. # GNUmakefile
  6. # Copyright 2010 Douglas Thrift
  7. #
  8. # Licensed under the Apache License, Version 2.0 (the "License");
  9. # you may not use this file except in compliance with the License.
  10. # You may obtain a copy of the License at
  11. #
  12. # http://www.apache.org/licenses/LICENSE-2.0
  13. #
  14. # Unless required by applicable law or agreed to in writing, software
  15. # distributed under the License is distributed on an "AS IS" BASIS,
  16. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17. # See the License for the specific language governing permissions and
  18. # limitations under the License.
  19. CXXFLAGS ?= -g -O2
  20. CXXFLAGS += -Wall -Wno-long-long
  21. LDLIBS := -lkvm -lncurses
  22. TARNAME := $(shell sed -e 's/^\#define DTPSTREE_PROGRAM "\(.*\)"$$/\1/p;d' dtpstree.cpp)-$(shell sed -e 's/^\#define DTPSTREE_VERSION "\(.*\)"$$/\1/p;d' dtpstree.cpp)
  23. PREFIX ?= /usr/local
  24. BINDIR ?= $(PREFIX)/bin
  25. MANDIR ?= $(PREFIX)/man
  26. MAN1DIR ?= $(MANDIR)/man1
  27. .PHONY: all man dist install uninstall clean
  28. all: dtpstree
  29. man: man1/dtpstree.1
  30. man1/%.1: % %.1.in
  31. help2man -I $*.1.in -Nn '$(shell sed -e '$$ s|^// ||p;d' $<.cpp)' -o $@ $(shell realpath $<)
  32. dist: man
  33. git archive --prefix=$(TARNAME)/ -v HEAD^{tree} | xz -vz - > $(TARNAME).tar.xz
  34. install: all
  35. install -dv $(DESTDIR)$(BINDIR) $(DESTDIR)$(MAN1DIR)
  36. install -cv dtpstree $(DESTDIR)$(BINDIR)
  37. install -cm 644 -v man1/dtpstree.1 $(DESTDIR)$(MAN1DIR)
  38. uninstall:
  39. rm -fv $(DESTDIR)$(BINDIR)/dtpstree
  40. rm -fv $(DESTDIR)$(MAN1DIR)/dtpstree.1
  41. clean:
  42. rm -fv dtpstree $(wildcard *core)