aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2016-12-28 14:34:00 +0100
committerMattias Andrée <maandree@kth.se>2016-12-28 14:34:00 +0100
commit855de87cbff6b24a03ce164a0b47d0d89abece48 (patch)
treeb98e94870687a4d279279e6e827d41d27bcf9a43
parentAdd xtest.1 (diff)
downloadxtest-855de87cbff6b24a03ce164a0b47d0d89abece48.tar.gz
xtest-855de87cbff6b24a03ce164a0b47d0d89abece48.tar.bz2
xtest-855de87cbff6b24a03ce164a0b47d0d89abece48.tar.xz
Add Makefile
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--Makefile56
1 files changed, 56 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..6947d0d
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,56 @@
+PREFIX = /usr
+BINDIR = $(PREFIX)/bin
+DATADIR = $(PREFIX)/share
+MANDIR = $(DATADIR)/man
+MAN1DIR = $(MANDIR)/man1
+LICENSEDIR = $(DATADIR)/licenses
+
+PKGNAME = xtest
+COMMAND = xtest
+
+CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE
+CFLAGS = -std=c99 -Wall -pedantic
+
+all: xtest
+
+xtest: xtest.o
+
+.o:
+ $(CC) $(LDFLAGS) -o $@ $<
+
+.c.o:
+ $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
+
+install: install-base install-doc
+
+install-base: install-cmd install-copyright
+
+install-cmd: xtest
+ mkdir -p -- "$(DESTDIR)$(BINDIR)"
+ cp -f -- xtest "$(DESTDIR)$(BINDIR)/$(COMMAND)"
+ chmod 755 -- "$(DESTDIR)$(BINDIR)/$(COMMAND)"
+
+install-copyright: install-license
+
+install-license:
+ mkdir -p -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)"
+ cp -f -- LICENSE "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/LICENSE"
+ chmod 644 -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/LICENSE"
+
+install-doc: install-man
+
+install-man: install-man1
+
+install-man1:
+ mkdir -p -- "$(DESTDIR)$(MAN1DIR)"
+ cp -f -- xtest.1 "$(DESTDIR)$(MAN1DIR)/$(COMMAND).1"
+ chmod 644 -- "$(DESTDIR)$(MAN1DIR)/$(COMMAND).1"
+
+uninstall:
+ rm -- "$(DESTDIR)$(MAN1DIR)/$(COMMAND).1"
+ rm -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/LICENSE"
+ rm -- "$(DESTDIR)$(BINDIR)/$(COMMAND)"
+ rmdir -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)"
+
+.PHONY: all install install-base install-cmd install-copyright install-license \
+ install-doc install-man install-man1 uninstall