]> oss.titaniummirror.com Git - repo_shell.git/blob - Makefile
gitcreate: add option to set description
[repo_shell.git] / Makefile
1 MAIN := repo_shell
2 # Git derives its version "prefix" from tags
3
4 PREFIX := /usr/local
5 PROGRAMS := $(MAIN) mystrtok_test acl_test
6 SCRIPTS := $(shell ls scripts/*)
7 PACKAGE := $(MAIN)-package.tar.gz
8
9 # Add TMI's mkversion to render files xxx.in -> xxx, updating __appVersion__
10 # Massage the version coming back because setup.py build to exe only wants
11 # versions of the form a.b.c.d. We'll use this to our advantage to cause
12 # setup.py to error if the VERSION is either dirty, or if git, not a tag.
13 include mkversion.mk
14 #$(warning VERSION $(VERSION))
15 INFILES := $(shell ls *.in 2>/dev/null)
16 INFILES := $(INFILES:%.in=%)
17 #$(warning INFILES $(INFILES))
18
19 all: $(MAIN)
20
21 $(MAIN):%: %.c inih/ini.c git_acl.c stringutils.c stra.c utility.c version.c
22 $(CC) -I inih $^ -o $@
23
24 mystrtok_test: mystrtok_test.c stringutils.c utility.c
25 $(CC) -g $^ -o $@
26
27 acl_test: acl_test.c git_acl.c inih/ini.c stringutils.c stra.c utility.c
28 $(CC) -I inih $^ -o $@
29
30 $(INFILES):%: %.in .version
31 @echo "building $@ for $(VERSION)"
32 @sed -e 's|__appVersion__|$(VERSION)|g' < $< > $@-tmp
33 @diff -q $@-tmp $@ >/dev/null 2>&1 && rm -f $@-tmp || mv $@-tmp $@
34
35 .version: FORCE
36 @[ "$$(cat $@ 2>/dev/null)" != "$(VERSION)" ] && \
37 echo "$(VERSION)" > $@ || true
38
39 install: $(MAIN) $(SCRIPTS)
40 @install -D -o root -g root -m 4755 $(MAIN) $(PREFIX)/bin/$(MAIN)
41 @install -o root -g root -m 0755 $(SCRIPTS) $(PREFIX)/bin
42
43 uninstall:
44 @rm -f $(PREFIX)/bin/$(MAIN)
45 @for i in $(SCRIPTS); do rm -f $(PREFIX)/bin/$$i; done
46
47 $(PACKAGE): $(MAIN) $(SCRIPTS)
48 @rm -rf pkg.tmp
49 @mkdir pkg.tmp
50 @install -D -o root -g root -m 4755 $(MAIN) pkg.tmp/$(PREFIX)/bin/$(MAIN)
51 @install -o root -g root -m 0755 $(SCRIPTS) pkg.tmp/$(PREFIX)/bin
52 @cd pkg.tmp && tar czf ../$(PACKAGE) .
53 @rm -rf pkg.tmp
54 @echo "$(PACKAGE) created"
55
56 package: Makefile $(PACKAGE)
57
58 clean:
59 @rm -rf $(PROGRAMS) $(INFILES)
60
61 .PHONY: all install uninstall package clean FORCE