summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: ecbfe66f7f97e720d11e9503de24f41142072eda (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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 logger

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 $^

logger: logger.vala
	@echo "[VALAC] $^"
	@$(VALAC) --vapidir=. --Xcc=-I. --Xcc=-L. --Xcc=-lweatherstation --pkg posix --pkg libweatherstation --pkg sqlite3 $^

clean:
	rm -f $(OBJECTS) $(LONGNAME) $(SONAME) $(NAME) demo logger

.PHONY: all library clean