summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jacko Dirks <2016783+jackodirks@users.noreply.github.com>2018-05-01 16:07:16 +0200
committerGravatar Adrien Schildknecht <adrien+dev@schischi.me>2018-05-01 15:07:16 +0100
commite2c777cbf3a226522a4871f97916f0cb0bee3688 (patch)
treec8c7626f4d1f938288a049ffa5a14c7edde3fc5c
parent9a46efb2ad5f826c0659f7869c7a40c3344ae63f (diff)
Fixes Makefile: sanity, no longer cleans on build (#18)
-rw-r--r--Makefile20
1 files changed, 13 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index b25eea8..ac57069 100644
--- a/Makefile
+++ b/Makefile
@@ -2,11 +2,14 @@ CFILES=xcwd.c
CC=gcc
CFLAGS=-Wall -Wextra -std=gnu99 -O2
LDFLAGS=-lX11
-EXE="xcwd"
+EXE=xcwd
prefix=/usr
UNAME:=$(shell uname)
O=${CFILES:.c=.o}
+.PHONY: all clean distclean install
+.SUFFIXES: .c .o
+
ifeq ($(UNAME), Linux)
CFLAGS += -DLINUX
else
@@ -18,12 +21,7 @@ else
endif
endif
-${EXE}: clean ${O}
- ${CC} -o $@ ${O} ${CFLAGS} ${LDFLAGS}
-
-.SUFFIXES: .c .o
-.c.o:
- ${CC} -c $< ${CFLAGS}
+all: ${EXE}
clean:
rm -vf *.o
@@ -34,3 +32,11 @@ distclean: clean
install: ${EXE}
install -m 0755 ${EXE} $(prefix)/bin
+
+${EXE}: ${O}
+ ${CC} -o $@ ${O} ${CFLAGS} ${LDFLAGS}
+
+
+.c.o:
+ ${CC} -c $< ${CFLAGS}
+