PAMModule.defs   [plain text]


##
# PAMModule.defs
##
# Luke Howard <lukeh@padl.com>
##

#RC_JASPER=YES

#
# If ModuleIsBundle is YES, then bundles are
# built to wrap the module DSOs.
#
ModuleIsBundle = NO

ifndef CoreOSMakefiles
CoreOSMakefiles = $(MAKEFILEPATH)/CoreOS
endif

ifndef BuildDirectory
BuildDirectory = .
endif

ifndef Sources
Sources = .
endif

Extra_CC_Flags += -Ddarwin -no-cpp-precomp -Wall -Werror -I/usr/include/pam $(foreach arch,$(RC_ARCHS),-arch $(arch))
Extra_LD_Libraries += -lpam $(foreach arch,$(RC_ARCHS),-arch $(arch))

include $(CoreOSMakefiles)/Standard/Standard.make

ifdef Project
DSTROOT = /tmp/$(Project)/Release
endif

PAMModuleVersion = 2
ifeq ($(ModuleIsBundle),YES)
PAMModuleExtension = bundle
PAMModuleWrapper = $(PAMModuleName).$(PAMModuleExtension).$(PAMModuleVersion)
PAMModuleBundle = $(PAMModuleWrapper)/$(PAMModuleName)
else
PAMModuleExtension = so
PAMModuleBundle = $(PAMModuleName).$(PAMModuleExtension).$(PAMModuleVersion)
endif

PAMModuleSources = $(BuildDirectory)/$(PAMModuleName).c

ifndef PAMModuleObjects
PAMModuleObjects = $(PAMModuleSources:.c=.o)
endif

all:: $(PAMModuleBundle)

$(PAMModuleBundle): $(PAMModuleObjects)
	$(_v) /bin/echo "Building $(PAMModuleBundle)..."
ifeq ($(ModuleIsBundle),YES)
	$(_v) $(MKDIR) $(BuildDirectory)/$(PAMModuleWrapper)
endif
	$(_v) $(CC) $(LDFLAGS) $(CFLAGS) -bundle -o $(BuildDirectory)/$@ $(PAMModuleObjects)

install: $(PAMModuleBundle)
ifeq ($(ModuleIsBundle),YES)
	$(_v) $(INSTALL_DIRECTORY) $(DSTROOT)/usr/lib/pam/$(PAMModuleWrapper)
else
	$(_v) $(INSTALL_DIRECTORY) $(DSTROOT)/usr/lib/pam
endif
	$(_v) $(INSTALL) -c -m $(Install_File_Mode)			\
		$(BuildDirectory)/$(PAMModuleBundle)			\
		$(DSTROOT)/usr/lib/pam/$(PAMModuleBundle)

clean::
ifeq ($(ModuleIsBundle),YES)
	$(_v) (cd $(BuildDirectory) && $(RM) -rf $(PAMModuleWrapper))
endif
	$(_v) (cd $(BuildDirectory) && $(RM) $(PAMModuleBundle) $(PAMModuleObjects))