blob: 4bffe01d3d5b934d618a51042f0ce4cabeefd0f2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
CFLAGS = -Wall -Wextra -Wpedantic -O2 -std=gnu11
PREFIX = /usr
BINDIR = /bin
INSPATH = $(DESTDIR)$(PREFIX)$(BINDIR)
.PHONY : all install uninstall
all:
@echo 'Error, target not specified.'
@echo ' To compile <filename>.c `make <filename>`'
@echo ' To install <filename> `make target=<filename> install`'
@echo ' To uninstall <filename> `make target=<filename> uninstall`'
% : %.c
$(CC) $(CFLAGS) -o $@ $^
$(DESTDIR)$(PREFIX)$(BINDIR)/% : %
install -Dm755 "$^" "$@"
install : $(DESTDIR)$(PREFIX)$(BINDIR)/$(target)
uninstall :
rm "$(DESTDIR)$(PREFIX)$(BINDIR)/$(target)"
clean :
find . -mindepth 1 -maxdepth 1 -executable -type f ! -name "prefix_header" -delete
|