diff options
author | Mattias Andrée <maandree@kth.se> | 2017-10-19 18:25:05 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2017-10-19 18:25:05 +0200 |
commit | 7b02e26ceb27c0f6402b76afb85b4d25dddd3e78 (patch) | |
tree | f9a206e3a43a99767fccbfb4f35d137fb36dab74 | |
parent | Remove unused code from arg.h (diff) | |
download | xtest-7b02e26ceb27c0f6402b76afb85b4d25dddd3e78.tar.gz xtest-7b02e26ceb27c0f6402b76afb85b4d25dddd3e78.tar.bz2 xtest-7b02e26ceb27c0f6402b76afb85b4d25dddd3e78.tar.xz |
Simplify
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r-- | .gitignore | 11 | ||||
-rw-r--r-- | LICENSE | 2 | ||||
-rw-r--r-- | Makefile | 64 | ||||
-rw-r--r-- | config.mk | 6 | ||||
-rw-r--r-- | xtest.c | 1 |
5 files changed, 32 insertions, 52 deletions
@@ -1,9 +1,6 @@ -\#*\# -.\#* *~ -*.bak -*.swo -*.swp -*.orig +*\#* *.o -xtest +*.su +*.out +/xtest @@ -1,6 +1,6 @@ ISC License -© 2016 Mattias Andrée <maandree@kth.se> +© 2016, 2017 Mattias Andrée <maandree@kth.se> Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -1,56 +1,34 @@ -PREFIX = /usr -BINDIR = $(PREFIX)/bin -DATADIR = $(PREFIX)/share -MANDIR = $(DATADIR)/man -MAN1DIR = $(MANDIR)/man1 -LICENSEDIR = $(DATADIR)/licenses +.POSIX: -PKGNAME = xtest -COMMAND = xtest - -CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -CFLAGS = -std=c99 -Wall -pedantic +CONFIGFILE = config.mk +include $(CONFIGFILE) all: xtest -xtest: xtest.o - .o: - $(CC) $(LDFLAGS) -o $@ $< + $(CC) -o $@ $^ $(LDFLAGS) .c.o: - $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -c $< - -install: install-base install-doc - -install-base: install-cmd install-copyright + $(CC) -c -o $@ $< $(CFLAGS) $(CPPFLAGS) -install-cmd: xtest - mkdir -p -- "$(DESTDIR)$(BINDIR)" - cp -f -- xtest "$(DESTDIR)$(BINDIR)/$(COMMAND)" - chmod 755 -- "$(DESTDIR)$(BINDIR)/$(COMMAND)" +xtest.o: arg.h -install-copyright: install-license +install: xtest + mkdir -p -- "$(DESTDIR)$(PREFIX)/bin" + mkdir -p -- "$(DESTDIR)$(MANPREFIX)/man1" + mkdir -p -- "$(DESTDIR)$(PREFIX)/share/licenses/xtest" + cp -- xtest "$(DESTDIR)$(PREFIX)/bin/" + cp -- xtest.1 "$(DESTDIR)$(MANPREFIX)/man1/" + cp -- LICENSE "$(DESTDIR)$(PREFIX)/share/licenses/xtest/" -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 +uninstall: + -rm -f -- "$(DESTDIR)$(PREFIX)/bin/xtest" + -rm -f -- "$(DESTDIR)$(MANPREFIX)/man1/xtest.1" + -rm -rf -- "$(DESTDIR)$(PREFIX)/share/licenses/xtest" -install-man1: - mkdir -p -- "$(DESTDIR)$(MAN1DIR)" - cp -f -- xtest.1 "$(DESTDIR)$(MAN1DIR)/$(COMMAND).1" - chmod 644 -- "$(DESTDIR)$(MAN1DIR)/$(COMMAND).1" +clean: + -rm -f -- xtest *.o -uninstall: - rm -- "$(DESTDIR)$(MAN1DIR)/$(COMMAND).1" - rm -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/LICENSE" - rm -- "$(DESTDIR)$(BINDIR)/$(COMMAND)" - rmdir -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)" +.SUFFIXES: .o .c.o -.PHONY: all install install-base install-cmd install-copyright install-license \ - install-doc install-man install-man1 uninstall +.PHONY: all install uninstall clean diff --git a/config.mk b/config.mk new file mode 100644 index 0000000..21f9f6f --- /dev/null +++ b/config.mk @@ -0,0 +1,6 @@ +PREFIX = /usr/local +MANPREFIX = $(PREFIX)/share/man + +CFLAGS = -std=c99 -Wall -pedantic -O2 +CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE +LDFLAGS = -s @@ -1,6 +1,5 @@ /* See LICENSE file for copyright and license details. */ #include <sys/stat.h> - #include <errno.h> #include <fcntl.h> #include <limits.h> |