diff options
author | Mattias Andrée <maandree@kth.se> | 2021-09-16 16:07:07 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2021-09-16 16:07:07 +0200 |
commit | 3b4046adeb0d56edd21144b693044a23ea798680 (patch) | |
tree | e513288cf14c386536125c84e4591af72473bb7b | |
parent | m makefile (diff) | |
download | alarm-3b4046adeb0d56edd21144b693044a23ea798680.tar.gz alarm-3b4046adeb0d56edd21144b693044a23ea798680.tar.bz2 alarm-3b4046adeb0d56edd21144b693044a23ea798680.tar.xz |
Improve makefile1.2.1
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r-- | Makefile | 18 | ||||
-rw-r--r-- | config.mk | 8 |
2 files changed, 14 insertions, 12 deletions
@@ -3,13 +3,14 @@ CONFIGFILE = config.mk include $(CONFIGFILE) + all: alarm -alarm.o: alarm.c - $(CC) -c -o $@ alarm.c $(CCFLAGS) $(CPPFLAGS) +.c.o: + $(CC) -c -o $@ $< $(CFLAGS) $(CPPFLAGS) -alarm: alarm.o - $(CC) -o $@ alarm.o $(LDFLAGS) +.o: + $(CC) -o $@ $< $(LDFLAGS) check: alarm ./alarm 1 sleep 2 & a=$$! ;\ @@ -19,19 +20,18 @@ check: alarm install: alarm mkdir -p -- "$(DESTDIR)$(PREFIX)/bin" - mkdir -p -- "$(DESTDIR)$(PREFIX)/share/licenses/alarm" mkdir -p -- "$(DESTDIR)$(MANPREFIX)/man1" cp -- alarm "$(DESTDIR)$(PREFIX)/bin/" - cp -- LICENSE "$(DESTDIR)$(PREFIX)/share/licenses/alarm/" cp -- alarm.1 "$(DESTDIR)$(MANPREFIX)/man1/" uninstall: -rm -- "$(DESTDIR)$(PREFIX)/bin/alarm" - -rm -- "$(DESTDIR)$(PREFIX)/share/licenses/alarm/LICENSE" -rm -- "$(DESTDIR)$(MANPREFIX)/man1/alarm.1" - -rmdir -- "$(DESTDIR)$(PREFIX)/share/licenses/alarm" clean: - -rm -rf -- alarm *.o + -rm -rf -- alarm *.o *.su + +.SUFFIXES: +.SUFFIXES: .o .c .PHONY: all check install uninstall clean @@ -1,6 +1,8 @@ -PREFIX = /usr/local +PREFIX = /usr MANPREFIX = $(PREFIX)/share/man -CCFLAGS = -std=c99 -Wall -Wextra -O2 -CPPFLAGS = +CC = cc + +CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700 +CFLAGS = -std=c99 -Wall -O2 LDFLAGS = -s |