]> oss.titaniummirror.com Git - repo_shell.git/commitdiff
make package builds simple .tgz for install
authorR. Steve McKown <rsmckown@gmail.com>
Fri, 28 Sep 2012 18:22:57 +0000 (12:22 -0600)
committerR. Steve McKown <rsmckown@gmail.com>
Fri, 28 Sep 2012 19:15:57 +0000 (13:15 -0600)
.gitignore
Makefile
git_acl.c

index c7859a14ead6811b9133fc422a79d21ec3986e53..b85387e9b47769eb067dc30493695980adf6f094 100644 (file)
@@ -1,6 +1,8 @@
 repo_shell
 acl_test
 mystrtok_test
+repo_shell-package.tar.gz
 version.c
+.version
 *.swp
 .svn
index 66de24252d9394b3e200ac44dea150a228ee6ef1..6cb5df23330c9a19db3f5effea523728d4b610d4 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,10 @@
 MAIN := repo_shell
 # Git derives its version "prefix" from tags
 
-PREFIX = /usr/local
-PROGRAMS = $(MAIN) mystrtok_test acl_test
-SCRIPTS = $(shell ls scripts/*)
+PREFIX := /usr/local
+PROGRAMS := $(MAIN) mystrtok_test acl_test
+SCRIPTS := $(shell ls scripts/*)
+PACKAGE := $(MAIN)-package.tar.gz
 
 # Add TMI's mkversion to render files xxx.in -> xxx, updating __appVersion__
 # Massage the version coming back because setup.py build to exe only wants
@@ -17,7 +18,7 @@ INFILES := $(INFILES:%.in=%)
 
 all: $(MAIN)
 
-repo_shell: repo_shell.c inih/ini.c git_acl.c stringutils.c stra.c utility.c version.c
+$(MAIN):%: %.c inih/ini.c git_acl.c stringutils.c stra.c utility.c version.c
        $(CC) -I inih $^ -o $@
 
 mystrtok_test: mystrtok_test.c stringutils.c utility.c
@@ -26,20 +27,35 @@ mystrtok_test: mystrtok_test.c stringutils.c utility.c
 acl_test: acl_test.c git_acl.c inih/ini.c stringutils.c stra.c utility.c
        $(CC) -I inih $^ -o $@
 
-$(INFILES):%: %.in
-       @sed -e 's|__appVersion__|$(VERSION)|g' < $^ > $@-tmp
+$(INFILES):%: %.in .version
+       @echo "building $@ for $(VERSION)"
+       @sed -e 's|__appVersion__|$(VERSION)|g' < $< > $@-tmp
        @diff -q $@-tmp $@ >/dev/null 2>&1 && rm -f $@-tmp || mv $@-tmp $@
 
+.version: FORCE
+       @[ "$$(cat $@ 2>/dev/null)" != "$(VERSION)" ] && \
+               echo "$(VERSION)" > $@ || true
+
 install: $(MAIN) $(SCRIPTS)
        @install -D -o root -g root -m 4755 $(MAIN) $(PREFIX)/bin/$(MAIN)
-       @install -D -o root -g root -m 4755 $(MAIN) $(PREFIX)/bin/$(MAIN)
-       @install -o root -g root -m 4755 $(SCRIPTS) $(PREFIX)/bin
+       @install -o root -g root -m 0755 $(SCRIPTS) $(PREFIX)/bin
 
 uninstall:
        @rm -f $(PREFIX)/bin/$(MAIN)
        @for i in $(SCRIPTS); do rm -f $(PREFIX)/bin/$$i; done
 
+$(PACKAGE): $(MAIN) $(SCRIPTS)
+       @rm -rf pkg.tmp
+       @mkdir pkg.tmp
+       @install -D -o root -g root -m 4755 $(MAIN) pkg.tmp/$(PREFIX)/bin/$(MAIN)
+       @install -o root -g root -m 0755 $(SCRIPTS) pkg.tmp/$(PREFIX)/bin
+       @cd pkg.tmp && tar czf ../$(PACKAGE) .
+       @rm -rf pkg.tmp
+       @echo "$(PACKAGE) created"
+
+package: Makefile $(PACKAGE)
+
 clean:
        @rm -rf $(PROGRAMS) $(INFILES)
 
-.PHONY: all insall uninstall clean $(INFILES)
+.PHONY: all install uninstall package clean FORCE
index 3c740dd10a4ac368fae242b0acf7ce41575486d3..6036166e598716d1a9e7cebf0e5ce1011a3db789 100644 (file)
--- a/git_acl.c
+++ b/git_acl.c
@@ -156,7 +156,6 @@ static int acl_handler(void* user, const char* section, const char* name,
     char *p = _p;
     char *repo = strip_repo(my_strtok(&p, " \t\n"));
 
-    debug("repo '%s'", repo);
     if (!repo || my_strtok(&p, " \t\n"))
       die("acl_handler: badly formatted section '%s'", section);
     /* repo is repo name, name is userid, value is permission */