diff --git a/Makefile b/Makefile index 12e07e5..719f7e8 100644 --- a/Makefile +++ b/Makefile @@ -3,9 +3,9 @@ CFLAGS += -std=gnu11 -pedantic -Wall -Wextra \ -Werror -Wno-missing-braces -Wno-missing-field-initializers \ -Wno-unused-variable -Wno-unused-parameter -Wformat=2 -Wswitch-default \ -Wno-unused-label -Wno-unused-function -Wcast-align -Wpointer-arith -Wbad-function-cast \ - -Wstrict-overflow=5 -Wstrict-prototypes -Winline -Wundef -Wnested-externs \ + -Wstrict-prototypes -Winline -Wundef -Wnested-externs \ -Wcast-qual -Wshadow -Wunreachable-code -Wfloat-equal \ - -Wstrict-aliasing=2 -Wredundant-decls -Wold-style-definition + -Wstrict-aliasing=3 -Wredundant-decls -Wold-style-definition LDFLAGS = -pthread SOURCES = con_queue.c log.c device_handler.c event_thread.c config.c connection.c \ data_channel.c snmp.c @@ -15,11 +15,11 @@ OBJECTS = $(patsubst %.c, build/%.o, $(SOURCES)) DEPS := $(OBJECTS:.o=.d) EXECUTABLES = build/brother-scand build/brother-scan-cli FIX_INCLUDE = fix_include -ETCDIR := /etc/brother-scand -BINDIR := /usr/bin +ETCDIR := $(DESTDIR)/etc/brother-scand +BINDIR := $(DESTDIR)/usr/bin PRINTUSER := brother-scand -SYSTEMDPATH := /etc/systemd/system/$(PRINTUSER).service -SYSLOGPATH := /etc/rsyslog.d/$(PRINTUSER).conf +SYSTEMDPATH := $(DESTDIR)/etc/systemd/system/$(PRINTUSER).service +SYSLOGPATH := $(DESTDIR)/etc/rsyslog.d/$(PRINTUSER).conf all: $(SOURCES) $(EXECUTABLES) @@ -52,15 +52,12 @@ build/%.o: %.c $(CC) $(CFLAGS) -c -o $@ $< install: all - adduser --system --no-create-home $(PRINTUSER) cp $(EXECUTABLES) $(BINDIR)/ mkdir -p $(ETCDIR) [ -e $(ETCDIR)/scanner.conf ] || cp out/brother.config $(ETCDIR)/scanner.conf for file in out/*.sh; do [ -e $(ETCDIR)/$$file ] || cp $$file $(ETCDIR)/; done - chown -R $(PRINTUSER) $(ETCDIR) cp brother-scand.service $(SYSTEMDPATH) cp syslog.conf $(SYSLOGPATH) - echo -e "Now edit $(ETCDIR)/scanner.conf. Then run:\n systemctl restart rsyslog\n systemctl enable $(PRINTUSER)" install_ufw: cp brscand.ufw_profile /etc/ufw/applications.d/brscand