commit 2c986af2817724e2512012595ce0c6cfb3dce8fd
parent 451ef531548eee9e17e818c0d28932dd8e79b200
Author: Léo Villeveygoux <leo.villeveygoux@etu.u-bordeaux.fr>
Date: Wed, 21 Jun 2017 18:57:30 +0200
Makefile: add install/uninstall rules
Only the `b8` binary is installed at the moment, to allow running the
`.bin` files directly as scripts from the shell.
Diffstat:
1 file changed, 14 insertions(+), 0 deletions(-)
diff --git a/Makefile b/Makefile
@@ -2,9 +2,14 @@ CFLAGS=-Wall -Wextra
LDFLAGS=-Wl,--section-start=mem_section=0x20000
LDLIBS=-lSDL2
+PREFIX=/usr/local
+BINDIR=$(PREFIX)/bin
+
PROG=b8
CARTS=$(patsubst %.asm,%.bin,$(wildcard *.asm))
+INSTALL_LIST=install.list
+
all: $(PROG) $(CARTS)
clean:
@@ -18,3 +23,12 @@ $(PROG): media.c
%.bin: %.s
yasm -f bin -r gas -p gas $< -o $@
+
+install: all
+ install -m0755 $(PROG) $(DESTDIR)$(BINDIR)
+ echo $(DESTDIR)$(BINDIR)/$(PROG) >> $(INSTALL_LIST)
+
+uninstall: $(INSTALL_LIST)
+ $(RM) $(foreach installed,$(file < $(INSTALL_LIST)),$(installed))
+ $(RM) $(INSTALL_LIST)
+