2 # Git derives its version "prefix" from tags
5 PROGRAMS
:= $(MAIN
) mystrtok_test acl_test
6 SCRIPTS
:= $(shell ls scripts
/*)
7 PACKAGE
:= $(MAIN
)-package.
tar.gz
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.
14 #$(warning VERSION $(VERSION))
15 INFILES
:= $(shell ls
*.in
2>/dev
/null
)
16 INFILES
:= $(INFILES
:%.in
=%)
17 #$(warning INFILES $(INFILES))
21 $(MAIN
):%: %.c inih
/ini.c git_acl.c stringutils.c stra.c utility.c version.c
22 $(CC
) -I inih
$^
-o
$@
24 mystrtok_test
: mystrtok_test.c stringutils.c utility.c
27 acl_test
: acl_test.c git_acl.c inih
/ini.c stringutils.c stra.c utility.c
28 $(CC
) -I inih
$^
-o
$@
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
$@
36 @
[ "$$(cat $@ 2>/dev/null)" != "$(VERSION)" ] && \
37 echo
"$(VERSION)" > $@ || true
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
44 @
rm -f
$(PREFIX
)/bin
/$(MAIN
)
45 @for i in
$(SCRIPTS
); do
rm -f
$(PREFIX
)/bin
/$$i; done
47 $(PACKAGE
): $(MAIN
) $(SCRIPTS
)
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
) .
54 @echo
"$(PACKAGE) created"
56 package
: Makefile
$(PACKAGE
)
59 @
rm -rf
$(PROGRAMS
) $(INFILES
)
61 .PHONY
: all install uninstall package
clean FORCE