-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(make): add package build command
- Loading branch information
1 parent
8ec268b
commit 1a8a059
Showing
1 changed file
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,20 @@ | ||
sources = src/dog.c src/functions.h src/dogos.h | ||
bindir = bin | ||
|
||
VERSION = $(shell cat VERSION) | ||
TEMP_DIR = dog_$(VERSION)_all | ||
|
||
CONTROL = $(TEMP_DIR)/DEBIAN/control | ||
POSTINST = $(TEMP_DIR)/DEBIAN/postinst | ||
|
||
main: $(bindir) | ||
mkdir -p $(bindir) | ||
gcc $(sources) -o $(bindir)/dog | ||
|
||
$(bindir): $(sources) | ||
mkdir -p $(bindir) | ||
|
||
.SILENT: install | ||
.SILENT: install clean | ||
|
||
install: install-dog install-man | ||
echo successfully installed dog | ||
|
@@ -21,3 +27,35 @@ install-man: | |
sudo cp man/dog.1 /usr/local/man/man1/dog.1 | ||
sudo gzip /usr/local/man/man1/dog.1 | ||
sudo mandb | ||
|
||
clean: | ||
rm -rf dog_$(VERSION)_all | ||
rm -rf bin | ||
rm *.deb | ||
|
||
build-man: | ||
pandoc man/man.md -s -t man -o man/dog.1 | ||
|
||
build-deb: main build-man | ||
mkdir $(TEMP_DIR) | ||
mkdir -p $(TEMP_DIR)/usr/local/bin | ||
mkdir -p $(TEMP_DIR)/DEBIAN | ||
|
||
cp $(bindir)/dog $(TEMP_DIR)/usr/local/bin | ||
|
||
echo "Package: dog" > $(CONTROL) | ||
echo "Version: $(VERSION)" >> $(CONTROL) | ||
echo "Architecture: all" >> $(CONTROL) | ||
echo "Maintainer: Juanjo Salvador <[email protected]>" >> $(CONTROL) | ||
echo "Description: A program that shows a dog barking into your terminal." >> $(CONTROL) | ||
|
||
echo "mkdir -p /usr/local/man/man1" > $(POSTINST) | ||
echo "cp man/dog.1 /usr/local/man/man1/dog.1" >> $(POSTINST) | ||
echo "gzip /usr/local/man/man1/dog.1" >> $(POSTINST) | ||
echo "mandb" >> $(POSTINST) | ||
|
||
chmod 0755 $(POSTINST) | ||
|
||
dpkg-deb --build --root-owner-group $(TEMP_DIR) | ||
|
||
rm -rf $(TEMP_DIR) |