commit e9f983205ea05513c2cda4ea4e899b58e22ba258 parent 2aa6aa3b8726328f87dd03a7d1dcf8ce4eaffb8a Author: Anders Damsgaard <anders@adamsgaard.dk> Date: Mon, 24 Jun 2019 16:42:30 +0200 Refine 'install' Makefile target and add 'uninstall' target Diffstat:
M | Makefile | | | 26 | ++++++++++++++++++-------- |
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/Makefile b/Makefile @@ -1,15 +1,25 @@ -CFLAGS=-g -std=c99 -pedantic -Wall -LDFLAGS=-lm -SRC=$(wildcard *.c) -OBJ=$(patsubst %.c,%.o,$(SRC)) -HDR=$(wildcard *.h) +CFLAGS = -g -std=c99 -pedantic -Wall +LDFLAGS = -lm +SRC = $(wildcard *.c) +OBJ = $(patsubst %.c,%.o,$(SRC)) +HDR = $(wildcard *.h) +BIN = 1d_fd_simple_shear + +PREFIX ?= /usr/local +INSTALL ?= install +STRIP ?= strip .PHONY: default -default: 1d_fd_simple_shear +default: $(BIN) .PHONY: install -install: 1d_fd_simple_shear - install $< /usr/local/bin/ +install: $(BIN) + $(STRIP) $(BIN) + $(INSTALL) -m 0755 -d $(DESTDIR)$(PREFIX)/bin + $(INSTALL) -m 0755 $(BIN) $(DESTDIR)$(PREFIX)/bin + +uninstall: + $(RM) $(DESTDIR)$(PREFIX)/bin/$(BIN) .PHONY: plots plots: 1d_fd_simple_shear.png \