Add config files and service file
This commit is contained in:
		
							
								
								
									
										44
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										44
									
								
								Makefile
									
									
									
									
									
								
							| @ -11,10 +11,14 @@ SRCS=src/main.c src/util.c src/lcd.c src/ths.c src/button.c src/ui/screen.c\ | ||||
|      src/ui/exportscreen.c | ||||
| PROG=rpi4b-temp-humidity | ||||
|  | ||||
| all: config.conf bin/${PROG} | ||||
|  | ||||
| OBJS=${SRCS:C/^src/bin/:C/.c$/.o/} | ||||
| bin/${PROG}: ${OBJS} | ||||
| 	${LD} ${LDFLAGS} -o ${@} ${OBJS} | ||||
|  | ||||
| bin/main.o bin/config.o: config.mk | ||||
|  | ||||
| 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 | ||||
| bin/ui/datapoints.o bin/ui/timesel.o bin/ui/statrange.o: src/util.h | ||||
| @ -30,7 +34,6 @@ bin/ui/statrange.o: src/ui/screen.h | ||||
| bin/main.o bin/ui/datesel.o bin/ui/statsby.o: src/ui/datesel.h | ||||
| bin/ui/datapoints.o bin/ui/timesel.o bin/ui/statrange.o: src/ui/datesel.h | ||||
|  | ||||
|  | ||||
| bin/main.o bin/ui/timesel.o bin/ui/datapoints.o: src/ui/timesel.h | ||||
| bin/ui/statrange.o: src/ui/timesel.h | ||||
|  | ||||
| @ -49,23 +52,34 @@ bin/main.o bin/drive.o bin/ui/exportscreen.o: src/drive.h | ||||
| .error Invalid temperature unit "${DEFAULT_TEMP_UNIT}" | ||||
| .endif | ||||
|  | ||||
| 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}"\ | ||||
| -DDEFAULT_FAIL_LIMIT="${DEFAULT_FAIL_LIMIT}"\ | ||||
| -DDEFAULT_DATABASE_LOCATION="${DEFAULT_DATABASE_LOCATION}"\ | ||||
| -DDEFAULT_REFRESH_TIME="${DEFAULT_REFRESH_TIME}"\ | ||||
| -DDEFAULT_TEMP_UNIT="${DEFAULT_TEMP_UNIT}"\ | ||||
| -DDEFAULT_EXPORT_FILE_NAME="${DEFAULT_EXPORT_FILE_NAME}"\ | ||||
|  | ||||
| ${OBJS}: ${.TARGET:C/^bin/src/:C/.o$/.c/} | ||||
| 	@mkdir -p ${.TARGET:H} | ||||
| 	${CC} ${CFLAGS} -c\ | ||||
| -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}\""\ | ||||
| -DDEFAULT_FAIL_LIMIT="${DEFAULT_FAIL_LIMIT}"\ | ||||
| -DDEFAULT_DATABASE_LOCATION="\"${DEFAULT_DATABASE_LOCATION}\""\ | ||||
| -DDEFAULT_REFRESH_TIME="${DEFAULT_REFRESH_TIME}"\ | ||||
| -DDEFAULT_TEMP_UNIT="'${DEFAULT_TEMP_UNIT}'"\ | ||||
| -DDEFAULT_EXPORT_FILE_NAME="\"${DEFAULT_EXPORT_FILE_NAME}\""\ | ||||
| -o ${@} ${.TARGET:C/^bin/src/:C/.o$/.c/} | ||||
| 	${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" | ||||
|  | ||||
| clean: | ||||
| 	rm -rf bin/ | ||||
| 	rm -rf config.conf bin/ | ||||
|  | ||||
| .SUFFIXES: .c .o | ||||
| .PHONY: clean | ||||
| .PHONY: all install clean | ||||
|  | ||||
		Reference in New Issue
	
	Block a user