How to compile...

Ed Schmollinger schmolli at frozencrow.org
Tue May 25 14:37:37 UTC 2004


On Tue, May 25, 2004 at 07:32:38AM -0600, Jason Gerfen wrote:
> Hello, I am fairly new to this list and have been attempting to learn 
> how to write PAM modules however the documentation on how to use the PAM 
> api is bit vague on how to compile the existing C.
> 
> I am using SuSE 9.0 and using Emacs to edit my first pam module.  The 
> string I am using to compile is as so...
> 
> gcc -o pam_test.so -libpam pam_test.c pam_test.h

Here's the Makefile I use:

-- CUT HERE --
CC=gcc
CFLAGS=-fPIC -O2 -Wall -Werror -pedantic
CPPFLAGS=-I.
LDFLAGS=-x --shared -lpam

OUT=pam_test.so

all:    $(OUT)

%.so: %.o
	ld $(LDFLAGS) -o $@ $<

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

install:
	install -s -o0 -g0 -m755 $(OUT) /lib/security
-- CUT HERE --

This would cause two commands to be executed:
gcc -fPIC -O2 -Wall -Werror -pedantic -I.  -c -o pam_test.o pam_test.c
ld -x --shared -lpam -o pam_test.so pam_test.o

Presumably, you have an appropriate #include in pam_test.c for
pam_test.h...

-- 
Ed Schmollinger - schmolli at frozencrow.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/pam-list/attachments/20040525/49ca995f/attachment.sig>


More information about the Pam-list mailing list