aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2017-10-17 20:11:30 +0200
committerMattias Andrée <maandree@kth.se>2017-10-17 20:11:30 +0200
commita568a539bbbe387cef14185488a75e8d3825c68b (patch)
tree06ecb3bd0ec4e328ed6ad63a49de0f23c9b3f7fc /Makefile
parentMakefile: fix uninstall rule: uninstall license (diff)
downloadpdeath-a568a539bbbe387cef14185488a75e8d3825c68b.tar.gz
pdeath-a568a539bbbe387cef14185488a75e8d3825c68b.tar.bz2
pdeath-a568a539bbbe387cef14185488a75e8d3825c68b.tar.xz
Simplify
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--Makefile50
1 files changed, 22 insertions, 28 deletions
diff --git a/Makefile b/Makefile
index 8db7678..0f5e821 100644
--- a/Makefile
+++ b/Makefile
@@ -1,38 +1,32 @@
-PREFIX = /usr
-BINDIR = $(PREFIX)/bin
-DATADIR = $(PREFIX)/share
-LICENSEDIR = $(DATADIR)/licences
-MANDIR = $(DATADIR)/man
-MAN1DIR = $(MANDIR)/man1
+.POSIX:
-PKGNAME = pdeath
-COMMAND = pdeath
+CONFIGFILE = config.mk
+include $(CONFIGFILE)
-OPTIMISE = -O2
-WARN = -Wall -Wextra -pedantic
+all: pdeath
+.o:
+ $(CC) -o $@ $^ $(LDFLAGS)
-all: cmd
-
-cmd: bin/pdeath
-
-bin/pdeath: src/pdeath.c
- @mkdir -p bin
- $(CC) -std=c99 $(OPTIMISE) $(WARN) -o $@ $^
+.c.o:
+ $(CC) -o $@ $< $(CPPFLAGS) $(CFLAGS)
install: bin/pdeath
- mkdir -p -- "$(DESTDIR)$(BINDIR)"
- cp -- bin/pdeath "$(DESTDIR)$(BINDIR)/$(COMMAND)"
- mkdir -p -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)"
- cp -- LICENSE "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/LICENSE"
- mkdir -p -- "$(DESTDIR)$(MAN1DIR)"
- cp doc/pdeath.1 -- "$(DESTDIR)$(MAN1DIR)/$(COMMAND).1"
+ mkdir -p -- "$(DESTDIR)$(PREFIX)/bin"
+ mkdir -p -- "$(DESTDIR)$(PREFIX)/share/licenses/pdeath"
+ mkdir -p -- "$(DESTDIR)$(MANPREFIX)/man1"
+ cp -- pdeath "$(DESTDIR)$(PREFIX)/bin/"
+ cp -- LICENSE "$(DESTDIR)$(PREFIX)/share/licenses/pdeath/"
+ cp -- pdeath.1 "$(DESTDIR)$(MANPREFIX)/man1/"
uninstall:
- -rm -- "$(DESTDIR)$(BINDIR)/$(COMMAND)"
- -rm -- "$(DESTDIR)$(MAN1DIR)/$(COMMAND).1"
- -rm -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/LICENSE"
- -rmdir -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)"
+ -rm -f -- "$(DESTDIR)$(PREFIX)/bin/pdeath"
+ -rm -f -- "$(DESTDIR)$(MANPREFIX)/man1/pdeath.1"
+ -rm -rf -- "$(DESTDIR)$(PREFIX)/share/licenses/pdeath"
clean:
- -rm -rf bin
+ -rm -f -- *.o pdeath
+
+SUFFIXES: .o .c.o
+
+.PHONY: all check install uninstall clean