summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeo (Sunpeng) Li <sunpeng.li@amd.com>2018-03-06 10:26:19 -0500
committerLeo (Sunpeng) Li <sunpeng.li@amd.com>2018-05-02 10:13:30 -0400
commit26483de56ee0cd483d05a16b136bcab0a5631347 (patch)
tree65922ee198b5147c6cd0f214a2ca33c8aa0be67c
parent029c904c3515fdd6a10ecd2e818516f7d4bade74 (diff)
Build everything in build dir, and ignore it.
Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@amd.com>
-rw-r--r--Makefile12
-rw-r--r--build/.gitignore2
2 files changed, 11 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 7474f68..ebabe2c 100644
--- a/Makefile
+++ b/Makefile
@@ -4,10 +4,16 @@ CC=gcc
LDFLAGS=$(shell pkg-config --cflags libdrm)
LDLIBS = $(shell pkg-config --libs libdrm) -lm
-SOURCES=$(wildcard *.c)
-EXECUTABLES=$(patsubst %.c,%,$(SOURCES))
+# All sources
+SOURCES=demo.c
+# The build directory
+BUILD=build
+# All executables to be cleaned
+EXECUTABLES=$(BUILD)/demo
-all: $(EXECUTABLES)
+$(BUILD)/demo: demo.c
+ $(CC) $(CFLAGS) $(LDFLAGS) $< $(LDLIBS) -o $@
+.PHONY: clean
clean:
rm -f $(EXECUTABLES)
diff --git a/build/.gitignore b/build/.gitignore
new file mode 100644
index 0000000..d6b7ef3
--- /dev/null
+++ b/build/.gitignore
@@ -0,0 +1,2 @@
+*
+!.gitignore