netplug / Makefile

version := $(shell awk '/define version/{print $$3}' netplug.spec)

prefix ?=
bindir ?= $(prefix)/sbin
etcdir ?= $(prefix)/etc/netplug
initdir ?= $(prefix)/etc/rc.d/init.d
scriptdir ?= $(prefix)/etc/netplug.d
mandir ?= $(prefix)/usr/share/man

install_opts := -o root -g root

CFLAGS += -Wall -Werror -std=gnu99 -g -DNP_ETC_DIR='"$(etcdir)"' \
	-DNP_SCRIPT_DIR='"$(scriptdir)"' -ggdb3 -O -DNP_VERSION='"$(version)"'

netplugd: config.o netlink.o lib.o if_info.o main.o
	$(CC) -o $@ $^

	install -d $(install_opts) -m 755 $(bindir) $(etcdir) $(scriptdir) \
		$(initdir) $(mandir)/man8
	install $(install_opts) -m 755 netplugd $(bindir)
	install -C $(install_opts) -m 644 etc/netplugd.conf $(etcdir)
	install -C $(install_opts) -m 755 scripts/netplug $(scriptdir)
	install $(install_opts) -m 755 scripts/rc.netplugd $(initdir)/netplugd
	install -C $(install_opts) -m 444 man/man8/netplugd.8 $(mandir)/man8

bk_root := $(shell bk root)
tar_root := netplug-$(version)
tar_file := $(bk_root)/$(tar_root).tar.bz2
files := $(shell bk sfiles -Ug)

tarball: $(tar_file)

$(tar_file): $(files)
	mkdir -p $(bk_root)/$(tar_root)
	echo $(files) | tr ' ' '\n' | \
	  xargs -i cp -a --parents {} $(bk_root)/$(tar_root)
	tar -C $(bk_root) -c -f - $(tar_root) | bzip2 -9 > $(tar_file)
	rm -rf $(bk_root)/$(tar_root)

rpm: $(tar_file)
	rpmbuild -ta $(tar_file)

fedora: $(tar_file)
	rpmbuild --define 'release 0.fdr.1' -ta $(tar_file)

	-rm -f netplugd *.o *.tar.bz2
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.