Files
cmdarg/Makefile

60 lines
1.5 KiB
Makefile
Raw Permalink Normal View History

2026-01-18 10:39:10 -05:00
ifndef PREFIX
PREFIX=/usr
endif
VERSION:=$(shell if [ -d .git ]; then bash -c '$(PREFIX)/bin/gitversion.sh | grep "^MAJOR=" | cut -d = -f 2'; else source version.sh && echo $$MAJOR ; fi)
RELEASE:=$(shell if [ -d .git ]; then bash -c '$(PREFIX)/bin/gitversion.sh | grep "^BUILD=" | cut -d = -f 2'; else source version.sh && echo $$BUILD ; fi)
2013-09-24 11:42:10 -04:00
DISTFILE=./dist/cmdarg-$(VERSION)-$(RELEASE).tar.gz
ifndef PREFIX
PREFIX=''
2013-10-08 14:22:38 -04:00
endif
2013-09-24 11:42:10 -04:00
DISTFILE_DEPS=$(shell find . -type f | grep -Ev '\.git|\./dist/|$(DISTFILE)')
2026-01-18 10:39:10 -05:00
JUNIT_DEPS=$(wildcard *.sh) $(wildcard tests/*.sh)
2013-09-24 11:42:10 -04:00
all: $(DISTFILE)
2013-09-24 11:42:10 -04:00
# --- PHONY targets
2026-01-18 10:39:10 -05:00
.PHONY: clean srpm rpm gitclean dist test test-ci
2013-09-24 11:42:10 -04:00
clean:
rm -f $(DISTFILE)
rm -fr dist/cmdarg-$(VERSION)-$(RELEASE)*
dist: $(DISTFILE)
gitclean:
git clean -df
2026-01-18 10:39:10 -05:00
test: tunit.txt
test-ci: junit.xml
2013-09-24 11:42:10 -04:00
# --- End phony targets
2026-01-18 10:39:10 -05:00
junit.xml: cmdarg.sh $(JUNIT_DEPS)
AK_PREFIX=. $(PREFIX)/bin/shunit.sh -f junit -t tests > junit.xml
tunit.txt: cmdarg.sh $(JUNIT_DEPS)
AK_PREFIX=. $(PREFIX)/bin/shunit.sh -f tunit -t tests | tee tunit.txt
2013-09-24 11:42:10 -04:00
version.sh:
2013-10-15 02:23:35 -04:00
gitversion.sh > version.sh
2013-09-24 11:42:10 -04:00
$(DISTFILE): version.sh
mkdir -p dist/
mkdir dist/cmdarg-$(VERSION)-$(RELEASE) || rm -fr dist/cmdarg-$(VERSION)-$(RELEASE)
rsync -aWH . --exclude=.git --exclude=dist ./dist/cmdarg-$(VERSION)-$(RELEASE)/
cd dist && tar -czvf ../$@ cmdarg-$(VERSION)-$(RELEASE)
uninstall:
rm -f $(PREFIX)/usr/lib/cmdarg.sh
install:
2026-01-18 10:39:10 -05:00
mkdir -p $(PREFIX)/lib
install ./cmdarg.sh $(PREFIX)/lib/cmdarg.sh
2013-09-24 11:42:10 -04:00
MANIFEST:
2026-01-18 10:39:10 -05:00
echo $(PREFIX)/lib/cmdarg.sh > MANIFEST