diff --git a/Makefile b/Makefile index 9ac517f..318bce4 100644 --- a/Makefile +++ b/Makefile @@ -1,35 +1,22 @@ +prefix = /usr +exec_prefix = ${prefix} + +bindir = ${exec_prefix}/bin +datarootdir = $(prefix)/share +mandir = ${datarootdir}/man + package = nyancat version = 0.1 tarname = $(package) distdir = $(tarname)-$(version) -all clean check nyancat: - cd src && $(MAKE) $@ - -dist: $(distdir).tar.gz +SRCDIR = src +INSTALL = /usr/bin/install -c -$(distdir).tar.gz: $(distdir) - tar chof - $(distdir) | gzip -9 -c > $@ - rm -rf $(distdir) - -$(distdir): FORCE - mkdir -p $(distdir)/src - cp Makefile $(distdir) - cp src/Makefile $(distdir)/src - cp src/nyancat.c $(distdir)/src - cp src/animation.h $(distdir)/src - cp src/telnet.h $(distdir)/src - -FORCE: - -rm $(distdir).tar.gz >/dev/null 2>&1 - -rm -rf $(distdir) >/dev/null 2>&1 +all clean check nyancat: + cd $(SRCDIR) && $(MAKE) $@ -distcheck: $(distdir).tar.gz - gzip -cd $(distdir).tar.gz | tar xvf - - cd $(distdir) && $(MAKE) all - cd $(distdir) && $(MAKE) check - cd $(distdir) && $(MAKE) clean - rm -rf $(distdir) - @echo "*** Package $(distdir).tar.gz is ready for distribution." +install : + $(INSTALL) -Dm 0755 $(SRCDIR)/$(package) $(DESTDIR)$(bindir)/$(package) -.PHONY: FORCE all clean check dist distcheck +.PHONY: all clean check install