From d4a843be76cd1f93f4b143e3df9516629b3b18fa Mon Sep 17 00:00:00 2001 From: Nathan Wagner Date: Tue, 10 Apr 2018 01:50:52 -0500 Subject: [PATCH] add tarball and zpm package targets --- Makefile | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7595154..5420710 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,10 @@ CFLAGS=-Wall -W -Wextra -Werror -std=c99 -Ilib -Isqlite -Ielf -I. -Ilzma/api +ZPMVER:=$(shell git tag --list 'v[0-9]*' | sed -e 's/^v//' | sort -nr | head -1) +ifeq ($(strip $(ZPMVER)),) + ZPMVER:=0.1 +endif + LZMAFLAGS=-Ilzma/api -Ilzma/tuklib -Ilzma/lzma -Ilzma/common -Ilzma/check -Ilzma/lz -Ilzma/rangecoder -Ilzma/simple -Ilzma/delta -DHAVE_CHECK_CRC64 -DHAVE_CHECK_CRC32 -DHAVE_ENCODER_LZMA2 -DHAVE_DECODER_LZMA2 -DHAVE_MF_BT4 LDFLAGS=-L. -ldl @@ -11,13 +16,34 @@ LZMAOBJ=$(filter-out lzma/common/stream_encoder_mt.o, $(LZMASRC:%.c=%.o)) curdir=$(shell pwd) ZPKGBIN=zpm-addfile zpm-extract zpm-init zpm-vercmp zpm-stat zpm-hash \ - zpm-findpkg zpm-shell + zpm-findpkg zpm-shell zpm-soneed + +SCRIPTS=zpm zpm-install +COMPILED=$(ZPKGBIN) +PROGRAMS=$(SCRIPTS) $(COMPILED) def: programs d: printf '%s\n' $(LZMAOBJ) printf '%s\n' $(PATH) +package: zpm-0.1-1.zpm + +ZPM:= ./zpm -P scripts:bin:. + +zpm-0.1-1.zpm: programs scripts + rm -f $@ + ./zpm -P scripts:bin:. newpackage -f $@ -v 0.1 zpm + ./zpm -P scripts:bin:. addtopackage -f $@ -P /usr/libexec/zpm -v 0.1 zpm $(PROGRAMS) + +tarball: zpm-0.1-1.tar.xz + +zpm-0.1-1.tar.xz: programs scripts + rm -f $@ + tar -cJf $@ --transform='s|^|usr/libexec/zpm/|' \ + --transform='s|^usr/libexec/zpm/zpm$$|usr/bin/zpm|' \ + $(PROGRAMS) + lzma.c: mklzma sh mklzma -- 2.40.0