commit c6dc082fdb96d01f1adeb5c3f1d2784610fa8021
parent 27d9c44a13c8241f8f9a0865763714d051d09dc8
Author: Yersa Nordman <yersa@finwo.nl>
Date: Tue, 14 Mar 2023 22:54:04 +0100
Added makefile target to create package
Diffstat:
3 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -2,5 +2,4 @@
/lib/
/pmlag
*.o
-/doc/dist
-node_modules/
+/package/
diff --git a/Makefile b/Makefile
@@ -5,7 +5,6 @@ SRC+=$(wildcard src/*.c)
SRC+=$(wildcard src/*/*.c)
override CFLAGS?=-Wall -s -O2
-override DESTDIR?=/usr/local
INCLUDES:=
INCLUDES+=-I src
@@ -22,6 +21,8 @@ BIN=pmlag
.PHONY: default
default: $(BIN) $(BIN).1 README.md
+include Makefile.pkg
+
%.o: %.c $(LIBS)
$(CC) $(CFLAGS) $(@:.o=.c) -D__NAME=\"$(BIN)\" -c -o $@
@@ -33,10 +34,13 @@ $(BIN).1: manpage.1.md
env NAME=$(BIN) envsubst < manpage.1.md | pandoc --standalone --from markdown --to man -o $(BIN).1
env NAME=$(BIN) envsubst < manpage.1.md | pandoc --standalone --from markdown --to html -o $(BIN).html
-.PHONY: install
-install: default
- install pmlag $(DESTDIR)/bin
- install pmlag.1 $(DESTDIR)/share/man/man1
+.PHONY: package
+package: default
+ mkdir -p package/pmlag
+ cp pmlag package/pmlag/pmlag
+ cp pmlag.1 package/pmlag/pmlag.1
+ cp Makefile.pkg package/pmlag/Makefile
+ (cd package ; tar c pmlag | gzip -9 > pmlag-linux-amd64.tar.gz)
.PHONY: clean
clean:
diff --git a/Makefile.pkg b/Makefile.pkg
@@ -0,0 +1,11 @@
+DESTDIR?=/usr/local
+
+.PHONY: default
+default:
+ # Run 'make install' to install this package
+
+.PHONY: install
+install: default
+ install pmlag $(DESTDIR)/bin
+ install pmlag.1 $(DESTDIR)/share/man/man1
+