aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Homer <mwh@mwh.geek.nz>2021-03-08 10:40:01 +1300
committerMichael Homer <mwh@mwh.geek.nz>2021-03-08 10:41:04 +1300
commit61230043fcd0905cd9ec6acc83a3c8bc91c287fa (patch)
tree41222a4754b952458d89063b37813caff29930a1
parentUpdate Makefile with PREFIX, DESTDIR and man page (diff)
downloaddragon-master.tar.gz
dragon-master.tar.bz2
dragon-master.zip
Add NAME Makefile variable to change program nameHEADmaster
The name defaults to "dragon", but make NAME=xdragon install will instead create an "xdragon" executable and man page, to allow avoiding conflicts with other software.
-rw-r--r--Makefile19
1 files changed, 10 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index 547d19d..cfd4de7 100644
--- a/Makefile
+++ b/Makefile
@@ -1,18 +1,19 @@
PREFIX = $(HOME)/.local
MANPREFIX = $(PREFIX)/share/man
+NAME = dragon
-all: dragon
+all: $(NAME)
-dragon: dragon.c
- $(CC) --std=c99 -Wall $(DEFINES) dragon.c -o dragon `pkg-config --cflags gtk+-3.0` `pkg-config --libs gtk+-3.0`
+$(NAME): dragon.c
+ $(CC) --std=c99 -Wall $(DEFINES) dragon.c -o $(NAME) `pkg-config --cflags gtk+-3.0` `pkg-config --libs gtk+-3.0`
-install: dragon
+install: $(NAME)
mkdir -p $(DESTDIR)$(PREFIX)/bin
- cp -f dragon $(DESTDIR)$(PREFIX)/bin
- chmod 755 $(DESTDIR)$(PREFIX)/bin/dragon
+ cp -f $(NAME) $(DESTDIR)$(PREFIX)/bin
+ chmod 755 $(DESTDIR)$(PREFIX)/bin/$(NAME)
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
- cp -f dragon.1 $(DESTDIR)$(MANPREFIX)/man1/dragon.1
- chmod 644 $(DESTDIR)$(MANPREFIX)/man1/dragon.1
+ sed -e "s/dragon/$(NAME)/g" dragon.1 > $(DESTDIR)$(MANPREFIX)/man1/$(NAME).1
+ chmod 644 $(DESTDIR)$(MANPREFIX)/man1/$(NAME).1
uninstall:
- rm -f $(DESTDIR)$(PREFIX)/bin/dragon $(DESTDIR)$(MANPREFIX)/man1/dragon.1
+ rm -f $(DESTDIR)$(PREFIX)/bin/$(NAME) $(DESTDIR)$(MANPREFIX)/man1/$(NAME).1
bgstack15