[cdi-devel] [PATCH 1/2] cdi: Add Makefile

Kevin Wolf ·

Add a Makefile to the CDI repository. Drivers are compiled using the
system compiler, but they are not linked. This allows at least some
basic compile testing without moving patches into the source tree of an
OS.

Signed-off-by: Kevin Wolf <kevin at tyndur.org>
---
 Makefile |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
 create mode 100644 Makefile

diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..b0ae0e0
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,17 @@
+SRCS = $(shell find -name '*.c')
+OBJS = $(addsuffix .o,$(basename $(SRCS)))
+
+CC = gcc
+CFLAGS = -m32 -Wall -g -I include -Werror -D_GNU_SOURCE
+
+run_command = $(if $(V),$(2), at echo $(1);$(2))
+
+all: $(OBJS)
+
+%.o: %.c
+	$(call run_command,"CC $^",$(CC) $(CFLAGS) $(addprefix -I,$(addprefix $(dir $^),. include)) -c -o $@ $^)
+
+clean:
+	rm $(OBJS)
+
+.PHONY: clean
-- 
1.6.0.2

Antworten