-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
48 lines (36 loc) · 1.17 KB
/
Makefile
File metadata and controls
48 lines (36 loc) · 1.17 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
# Makefile for sensor-bme680 (C version)
# Build BME680 sensor reader for Raspberry Pi using system libraries
# Extract version from debian/changelog using dpkg-parsechangelog
VERSION := $(shell dpkg-parsechangelog -S Version 2>/dev/null || echo "0.0.0")
CC = gcc
CFLAGS = $(EXTRA_CFLAGS) -Wall -Wextra -O2 -std=c99 -I/usr/include/ws -DVERSION=\"$(VERSION)\"
LDFLAGS = $(EXTRA_LDFLAGS) -lwildlifesystems
PREFIX = /usr/local
BINDIR = $(PREFIX)/bin
MANDIR = $(PREFIX)/share/man/man1
SRCDIR = src
TARGET = sensor-bme680
SOURCES = $(SRCDIR)/main.c $(SRCDIR)/bme680.c
HEADERS = $(SRCDIR)/bme680.h
.PHONY: all clean install uninstall debug deb
all: $(TARGET)
$(TARGET): $(SOURCES) $(HEADERS)
$(CC) $(CFLAGS) -o $@ $(SOURCES) $(LDFLAGS)
# Build with debug symbols
debug: CFLAGS += -g -DDEBUG
debug: $(TARGET)
# Install the binary and man page
install: $(TARGET)
install -d $(DESTDIR)$(BINDIR)
install -m 755 $(TARGET) $(DESTDIR)$(BINDIR)/
install -d $(DESTDIR)$(MANDIR)
install -m 644 man/sensor-bme680.1 $(DESTDIR)$(MANDIR)/
# Uninstall
uninstall:
rm -f $(DESTDIR)$(BINDIR)/$(TARGET)
# Clean build artifacts
clean:
rm -f $(TARGET)
# For Debian packaging
deb:
dpkg-buildpackage -us -uc -b