diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 31 |
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 |