2024-03-01 00:21:20 -08:00
|
|
|
# -*- mode: makefile -*-
|
|
|
|
.include "config.mk"
|
|
|
|
|
2024-02-23 17:55:56 -08:00
|
|
|
CC=clang
|
2024-03-05 00:54:32 -08:00
|
|
|
CFLAGS=-g -std=c11 -Wall ${SQLITE3_CFLAGS}
|
2024-02-23 17:55:56 -08:00
|
|
|
LD=clang
|
2024-04-01 21:14:47 -07:00
|
|
|
LDFLAGS=-lgpio -lfigpar -lpthread ${SQLITE3_LDFLAGS}
|
2024-04-01 13:56:24 -07:00
|
|
|
SRCS=src/main.c src/util.c src/lcd.c src/ths.c src/button.c src/ui/screen.c\
|
2024-04-02 00:20:35 -07:00
|
|
|
src/ui/datesel.c src/ui/statsby.c src/ui/datapoints.c src/ui/timesel.c\
|
2024-04-04 00:53:29 -07:00
|
|
|
src/ui/statrange.c src/config.c src/ui/blankscreen.c src/drive.c\
|
2024-04-05 04:16:42 -07:00
|
|
|
src/ui/exportscreen.c src/ui/setdatescreen.c src/ui/viewdatescreen.c\
|
2024-04-08 01:11:15 -07:00
|
|
|
src/ui/powerscreen.c src/ui/settzscreen.c src/ui/cleardatascreen.c
|
2024-02-28 05:31:35 -08:00
|
|
|
PROG=rpi4b-temp-humidity
|
2024-02-23 17:55:56 -08:00
|
|
|
|
2024-04-05 01:31:05 -07:00
|
|
|
all: config.conf bin/${PROG}
|
|
|
|
|
2024-02-28 05:31:35 -08:00
|
|
|
OBJS=${SRCS:C/^src/bin/:C/.c$/.o/}
|
|
|
|
bin/${PROG}: ${OBJS}
|
|
|
|
${LD} ${LDFLAGS} -o ${@} ${OBJS}
|
2024-02-23 17:55:56 -08:00
|
|
|
|
2024-04-05 01:31:05 -07:00
|
|
|
bin/main.o bin/config.o: config.mk
|
|
|
|
|
2024-04-01 13:56:24 -07:00
|
|
|
bin/main.o bin/util.o bin/lcd.o bin/ths.o bin/button.o: src/util.h
|
|
|
|
bin/ui/screen.o bin/ui/statsby.o bin/ui/datesel.o: src/util.h
|
2024-04-02 00:20:35 -07:00
|
|
|
bin/ui/datapoints.o bin/ui/timesel.o bin/ui/statrange.o: src/util.h
|
2024-04-05 04:16:42 -07:00
|
|
|
bin/ui/viewdatescreen.o bin/ui/setdatescreen.o bin/ui/powerscreen.o: src/util.h
|
2024-04-08 01:11:15 -07:00
|
|
|
bin/ui/settzscreen.o bin/ui/cleardatascreen.o: src/util.h
|
2024-04-01 13:56:24 -07:00
|
|
|
|
|
|
|
bin/main.o bin/lcd.o bin/screen.o bin/ui/datesel.o: src/lcd.h
|
2024-04-02 00:20:35 -07:00
|
|
|
bin/ui/statsby.o bin/ui/timesel.o bin/ui/statrange.o: src/lcd.h
|
2024-04-05 04:16:42 -07:00
|
|
|
bin/ui/datapoints.o bin/ui/viewdatescreen.o: src/lcd.h
|
|
|
|
bin/ui/setdatescreen.o bin/ui/powerscreen.o: src/lcd.h
|
2024-04-08 01:11:15 -07:00
|
|
|
bin/ui/settzscreen.o bin/ui/cleardatascreen.o: src/lcd.h
|
2024-04-01 21:14:47 -07:00
|
|
|
|
|
|
|
bin/main.o bin/ui/screen.o bin/ui/statsby.o: src/ui/screen.h
|
|
|
|
bin/ui/datesel.o bin/ui/datapoints.o bin/ui/timesel.o: src/ui/screen.h
|
2024-04-05 04:16:42 -07:00
|
|
|
bin/ui/statrange.o bin/ui/setdatescreen.o: src/ui/screen.h
|
|
|
|
bin/ui/viewdatescreen.o bin/ui/powerscreen.o: src/ui/screen.h
|
2024-04-08 01:11:15 -07:00
|
|
|
bin/ui/settzscreen.o bin/ui/cleardatascreen.o: src/ui/screen.h
|
2024-04-01 21:14:47 -07:00
|
|
|
|
|
|
|
bin/main.o bin/ui/datesel.o bin/ui/statsby.o: src/ui/datesel.h
|
2024-04-02 00:20:35 -07:00
|
|
|
bin/ui/datapoints.o bin/ui/timesel.o bin/ui/statrange.o: src/ui/datesel.h
|
2024-04-05 04:16:42 -07:00
|
|
|
bin/ui/setdatescreen.o: src/ui/datesel.h
|
2024-04-01 13:56:24 -07:00
|
|
|
|
2024-04-01 21:14:47 -07:00
|
|
|
bin/main.o bin/ui/timesel.o bin/ui/datapoints.o: src/ui/timesel.h
|
2024-04-05 04:16:42 -07:00
|
|
|
bin/ui/statrange.o bin/ui/setdatescreen.o: src/ui/timesel.h
|
2024-04-02 00:20:35 -07:00
|
|
|
|
2024-04-02 14:53:04 -07:00
|
|
|
bin/main.o bin/ths.o: src/ths.h
|
|
|
|
bin/main.o bin/config.o: src/config.h
|
2024-04-01 13:56:24 -07:00
|
|
|
bin/main.o bin/button.o bin/ui/screen.o: src/button.h
|
|
|
|
bin/main.o bin/ui/statsby.o: src/ui/statsby.h
|
2024-04-01 21:14:47 -07:00
|
|
|
bin/main.o bin/ui/datapoints.o: src/ui/datapoints.h
|
2024-04-02 16:17:43 -07:00
|
|
|
bin/main.o bin/ui/blankscreen.o: src/ui/blankscreen.h
|
2024-04-02 00:20:35 -07:00
|
|
|
bin/main.o bin/ui/statrange.o: src/ui/statrange.h
|
2024-04-05 04:16:42 -07:00
|
|
|
bin/main.o bin/ui/exportscreen.o: src/ui/exportscreen.h
|
|
|
|
bin/main.o bin/ui/setdatescreen.o: src/ui/setdatescreen.h
|
|
|
|
bin/main.o bin/ui/viewdatescreen.o: src/ui/viewdatescreen.h
|
|
|
|
bin/main.o bin/ui/powerscreen.o: src/ui/powerscreen.h
|
2024-04-08 01:11:15 -07:00
|
|
|
bin/main.o bin/ui/settzscreen.o: src/ui/settzscreen.h
|
|
|
|
bin/main.o bin/ui/cleardatascreen.o: src/ui/cleardatascreen.h
|
2024-04-04 00:53:29 -07:00
|
|
|
bin/main.o bin/drive.o bin/ui/exportscreen.o: src/drive.h
|
2024-02-23 22:56:10 -08:00
|
|
|
|
2024-04-02 14:53:04 -07:00
|
|
|
.if "${DEFAULT_TEMP_UNIT}" != "F" && "${DEFAULT_TEMP_UNIT}" != "C" &&\
|
|
|
|
"${DEFAULT_TEMP_UNIT}" != "c" && "${DEFAULT_TEMP_UNIT}" != "c"
|
|
|
|
.error Invalid temperature unit "${DEFAULT_TEMP_UNIT}"
|
|
|
|
.endif
|
|
|
|
|
2024-04-05 01:31:05 -07:00
|
|
|
DEFINES:=\
|
|
|
|
-DDEFAULT_CONFIG_PATH="${DEFAULT_CONFIG_PATH}"\
|
|
|
|
-DDEFAULT_GPIO_DEVICE="${DEFAULT_GPIO_DEVICE}"\
|
|
|
|
-DDEFAULT_TEMP_KEY="${DEFAULT_TEMP_KEY}"\
|
|
|
|
-DDEFAULT_HUMID_KEY="${DEFAULT_HUMID_KEY}"\
|
|
|
|
-DDEFAULT_FAIL_KEY="${DEFAULT_FAIL_KEY}"\
|
2024-02-25 23:59:26 -08:00
|
|
|
-DDEFAULT_FAIL_LIMIT="${DEFAULT_FAIL_LIMIT}"\
|
2024-04-05 01:31:05 -07:00
|
|
|
-DDEFAULT_DATABASE_LOCATION="${DEFAULT_DATABASE_LOCATION}"\
|
2024-02-28 12:09:18 -08:00
|
|
|
-DDEFAULT_REFRESH_TIME="${DEFAULT_REFRESH_TIME}"\
|
2024-04-05 01:31:05 -07:00
|
|
|
-DDEFAULT_TEMP_UNIT="${DEFAULT_TEMP_UNIT}"\
|
|
|
|
-DDEFAULT_EXPORT_FILE_NAME="${DEFAULT_EXPORT_FILE_NAME}"\
|
2024-04-08 01:11:15 -07:00
|
|
|
-DDEFAULT_TIMEZONE="${DEFAULT_TIMEZONE}"\
|
2024-04-05 01:31:05 -07:00
|
|
|
|
|
|
|
${OBJS}: ${.TARGET:C/^bin/src/:C/.o$/.c/}
|
|
|
|
@mkdir -p ${.TARGET:H}
|
|
|
|
${CC} ${CFLAGS} -c ${DEFINES} -o ${@} ${.TARGET:C/^bin/src/:C/.o$/.c/}
|
|
|
|
|
|
|
|
config.conf: config.conf.m4
|
|
|
|
m4 ${DEFINES} config.conf.m4 >config.conf
|
|
|
|
|
|
|
|
install: all
|
|
|
|
mkdir -p "${PREFIX}/bin"
|
|
|
|
install -o root -g wheel "bin/${PROG}" "${PREFIX}/bin"
|
|
|
|
mkdir -p "${PREFIX}/etc/rpi4b-temp-humidity"
|
|
|
|
install -b -o root -g wheel -m 0644 config.conf "${PREFIX}/etc/rpi4b-temp-humidity"
|
|
|
|
install -o root -g wheel -m 0555 rpi4b-temp-humidity "${PREFIX}/etc/rc.d"
|
2024-02-23 17:55:56 -08:00
|
|
|
|
2024-02-23 22:56:10 -08:00
|
|
|
clean:
|
2024-04-05 01:31:05 -07:00
|
|
|
rm -rf config.conf bin/
|
2024-02-23 22:56:10 -08:00
|
|
|
|
2024-02-23 17:55:56 -08:00
|
|
|
.SUFFIXES: .c .o
|
2024-04-05 01:31:05 -07:00
|
|
|
.PHONY: all install clean
|