# Installation directories.
PREFIX ?= /usr/local/selinux
BINDIR ?= $(PREFIX)/bin

# libselinux library and include directories.
# Pull from the local copy unless you separately installed libselinux first.
LIBSELDIR ?= ../libselinux/src
LIBSELINC ?= ../libselinux/include

CFLAGS ?= -Wall -I$(LIBSELINC) 
LDFLAGS ?= -L$(LIBSELDIR) 
LDLIBS ?= -lselinux

# Build static so that we can put it on an initrd.
LDFLAGS += -static

TARGETS=$(patsubst %.c,%,$(wildcard *.c))

all: $(TARGETS)

install: all
	-mkdir -p $(BINDIR)
	install -m 755 $(TARGETS) $(BINDIR)

clean:
	rm -f $(TARGETS) *.o 

relabel:
	setfilecon system_u:object_r:load_policy_exec_t $(BINDIR)/load_policy 
