summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorSebastian Reichel <sre@ring0.de>2012-02-26 19:25:42 +0100
committerSebastian Reichel <sre@ring0.de>2012-02-26 19:25:42 +0100
commit2e82359fa5bf7c34e9cbb3436fe9da0289710399 (patch)
treec6b017359328258116d370273d7c18cc15eb81d3 /Makefile
downloadweatherstation-2e82359fa5bf7c34e9cbb3436fe9da0289710399.tar.bz2
initial code import
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile31
1 files changed, 31 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..aee11ca
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,31 @@
+VALAC?=valac
+SOURCES:=$(wildcard *.c)
+OBJECTS:=$(patsubst %.c, %.o, $(SOURCES))
+CFLAGS+=`pkg-config --cflags libusb`
+LIBS+=`pkg-config --libs libusb`
+NAME:=libweatherstation.so
+SONAME=$(NAME).0
+LONGNAME=$(NAME).0.0
+
+all: library demo
+
+library: $(LONGNAME)
+ @ln -sf $(LONGNAME) $(SONAME)
+ @ln -sf $(SONAME) $(NAME)
+
+%.o: %.c
+ @echo "[CC] $<"
+ @$(CC) $(CFLAGS) -c -std=c99 -fPIC -o $@ $<
+
+$(LONGNAME): $(OBJECTS)
+ @echo "[LD] $^"
+ @$(CC) -shared -Wl,-soname,$(SONAME) -o $@ $(LIBS) $^
+
+demo: demo.vala
+ @echo "[VALAC] $^"
+ @$(VALAC) --vapidir=. --Xcc=-I. --Xcc=-L. --Xcc=-lweatherstation --pkg posix --pkg libweatherstation $^
+
+clean:
+ rm -f $(OBJECTS) $(LONGNAME) $(SONAME) $(NAME) demo
+
+.PHONY: all library clean