From 40d433fd2b65e2069da959aaf44a817f7a6e7335 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Piotrowski?= <b@bpiotrowski.pl> Date: Mon, 15 Dec 2014 19:51:16 +0100 Subject: [PATCH] Rewrite Makefile - use implicit rule to create the binary - aim at C99 by default - use install to put the executable in correct place - use 'rm -f' in clean target - remove unused variables --- Makefile | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 7617bc5..e7cf050 100644 --- a/Makefile +++ b/Makefile @@ -1,19 +1,12 @@ -PROJ = fanout -OBJS = -CC = gcc -DEBUG = -g -CFLAGS = -Wall -c $(DEBUG) -LFLAGS = -Wall $(DEBUG) +SRC = fanout.c +OBJ = ${SRC:.c=.o} +CFLAGS = -std=c99 -Wall -g DESTDIR = / -.PHONY : $(OBJS) +fanout: -fanout : fanout.c - $(CC) $(LFLAGS) $(OBJS) -o $(PROJ) fanout.c - -install: - mkdir -p $(DESTDIR)/usr/sbin - cp fanout $(DESTDIR)/usr/sbin/fanout +install: fanout + install -Dm755 fanout $(DESTDIR)/usr/bin/fanout clean: - test \! -f fanout || rm fanout + rm -f fanout -- GitLab