aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2021-09-16 16:24:43 +0200
committerMattias Andrée <maandree@kth.se>2021-09-16 16:24:43 +0200
commite2a4445825c6c221f66c0995de87a2a4c2ebd749 (patch)
tree8f5c643477209945f19c78e3c53ff89ee95ee35b
parentmakefile: fix clean: remove *.o (diff)
downloadexec-as-e2a4445825c6c221f66c0995de87a2a4c2ebd749.tar.gz
exec-as-e2a4445825c6c221f66c0995de87a2a4c2ebd749.tar.bz2
exec-as-e2a4445825c6c221f66c0995de87a2a4c2ebd749.tar.xz
Improve makefile + m whitespace fix1.2.1
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r--Makefile15
-rw-r--r--config.mk6
-rw-r--r--test.c1
3 files changed, 10 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index 15dc151..d57a21c 100644
--- a/Makefile
+++ b/Makefile
@@ -3,13 +3,11 @@
CONFIGFILE = config.mk
include $(CONFIGFILE)
-all: exec-as test
-exec-as: exec-as.o
- $(CC) -o $@ exec-as.o $(LDFLAGS)
+all: exec-as test
-test: test.o
- $(CC) -o $@ test.o $(LDFLAGS)
+.o:
+ $(CC) -o $@ $< $(LDFLAGS)
.c.o:
$(CC) -c -o $@ $< $(CFLAGS) $(CPPFLAGS)
@@ -18,21 +16,18 @@ check: exec-as test
test "$$(./exec-as ./test)" = ""
test "$$(./exec-as ./test 1 2 3)" = "1,3"
-install:
+install: exec-as
mkdir -p -- "$(DESTDIR)$(PREFIX)/bin"
mkdir -p -- "$(DESTDIR)$(MANPREFIX)/man1"
- mkdir -p -- "$(DESTDIR)$(PREFIX)/share/licenses/exec-as"
cp -- exec-as "$(DESTDIR)$(PREFIX)/bin/"
cp -- exec-as.1 "$(DESTDIR)$(MANPREFIX)/man1/"
- cp -- LICENSE "$(DESTDIR)$(PREFIX)/share/licenses/exec-as/"
uninstall:
-rm -f -- "$(DESTDIR)$(PREFIX)/bin/exec-as"
-rm -f -- "$(DESTDIR)$(MANPREFIX)/man1/exec-as.1"
- -rm -rf -- "$(DESTDIR)$(PREFIX)/share/licenses/exec-as"
clean:
- -rm -f -- exec-as test *.o
+ -rm -f -- exec-as test *.o *.su
.SUFFIXES:
.SUFFIXES: .o .c
diff --git a/config.mk b/config.mk
index 9e148ca..aa81003 100644
--- a/config.mk
+++ b/config.mk
@@ -1,6 +1,8 @@
-PREFIX = /usr/local
+PREFIX = /usr
MANPREFIX = $(PREFIX)/share/man
-CFLAGS = -std=c99 -Wall -Wextra -O2
+CC = cc
+
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700
+CFLAGS = -std=c99 -Wall -O2
LDFLAGS = -s
diff --git a/test.c b/test.c
index b0c0bd8..41fff1f 100644
--- a/test.c
+++ b/test.c
@@ -1,6 +1,7 @@
/* See LICENSE file for copyright and license details. */
#include <stdio.h>
+
int
main(int argc, char *argv[])
{