opensnitch/daemon/Makefile
clayton craft 8f49816dee
daemon/Makefile: improvements to make distro packaging easier (#780)
* daemon/Makefile: add support for PREFIX, DESTDIR, SYSCONFDIR in install

This is helpful for package maintainers who need to install components
into specific locations for building packages of this project.

example:
$ make \
    PREFIX=/usr \
    DESTDIR=/some/package/dir \
    SYSCONFDIR=/foo/etc \
    install

* daemon/Makefile: use 'install' to copy files / make dirs
2022-12-21 10:35:52 +01:00

26 lines
624 B
Makefile

#SRC contains all *.go *.c *.h files in daemon/ and its subfolders
SRC := $(shell find . -type f -name '*.go' -o -name '*.h' -o -name '*.c')
PREFIX?=/usr/local
all: opensnitchd
install:
@mkdir -p $(DESTDIR)/etc/opensnitchd/rules
@install -Dm755 opensnitchd \
-t $(DESTDIR)$(PREFIX)/bin/
@install -Dm644 opensnitchd.service \
-t $(DESTDIR)/etc/systemd/system/
@install -Dm644 default-config.json \
-t $(DESTDIR)/etc/opensnitchd/
@install -Dm644 system-fw.json \
-t $(DESTDIR)/etc/opensnitchd/
@systemctl daemon-reload
opensnitchd: $(SRC)
@go get
@go build -o opensnitchd .
clean:
@rm -rf opensnitchd