LSMVER=-2.4

all:
	@echo "You must explicitly specify 'quickinstall'."
	@echo "Be sure to read the QUICK INSTALL instructions in the README first."

insert:
	@echo "Patching the LSM tree."
	cd module && make insert LSMVER=$(LSMVER)	
	touch insert

quickinstall: insert
	@echo "Configuring the SELinux kernel."
	cd ../lsm$(LSMVER) && make menuconfig 
	@echo "Building the SELinux kernel."
	cd ../lsm$(LSMVER) && make dep && make && make modules
	@echo "Installing the SELinux kernel."
	cd ../lsm$(LSMVER); make install; make modules_install
	@echo "Building and installing support files needed by the userland components."
	cd module && make install LSMVER=$(LSMVER)
	@echo "Building and installing the policy configuration."
	cd policy && make install
	@echo "Building and installing libsecure."
	cd libsecure && make install
	@echo "Building and installing the SELOPT utils."
	cd selopt && make LSMVER=$(LSMVER) && make install
	@echo "Building and installing the modified daemons and the new or modified utilities."
	cd utils && make install
	@echo "Installing the application context configuration files."
	if [ ! -f /etc/security/default_context ]; then install -m 644 utils/appconfig/default_context /etc/security; fi
	if [ ! -f /etc/security/default_type ]; then install -m 644 utils/appconfig/default_type /etc/security; fi
	if [ ! -f /etc/security/cron_context ]; then install -m 644 utils/appconfig/cron_context /etc/security; fi
	if [ ! -f /etc/security/initrc_context ]; then install -m 644 utils/appconfig/initrc_context /etc/security; fi
	@echo "Setting the file security contexts."
	cd setfiles && make relabel
	@echo "Done."
