[Mesa-dev] [PATCH shader-db 1/3] Makefile: avoid undefined reference build errors with LIBS

Rhys Kidd rhyskidd at gmail.com
Sat Oct 10 22:30:12 PDT 2015


Signed-off-by: Rhys Kidd <rhyskidd at gmail.com>
---
 .gitignore |  1 +
 Makefile   | 14 +++++++++++---
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/.gitignore b/.gitignore
index f69750a..cffa19c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
 bin
 run
+*.o
diff --git a/Makefile b/Makefile
index 1ae0776..a4bfb8f 100644
--- a/Makefile
+++ b/Makefile
@@ -21,9 +21,17 @@
 
 CFLAGS ?= -g -O2 -march=native -pipe
 CFLAGS += -std=gnu99 -fopenmp
-LDFLAGS = -lepoxy -lgbm
+LIBS = -lepoxy -lgbm
 
-run:
+OBJ = run.o
+
+all: run
+
+%.o: %.c
+	$(CC) -c -o $@ $< $(CFLAGS)
+
+run: $(OBJ)
+	$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
 
 clean:
-	rm -f run
+	rm -f run $(OBJ)
-- 
2.1.4



More information about the mesa-dev mailing list