CC       = gcc
AR       = ar
INCLUDE  = -I. -I../
LIB_PATH = 
DEFINES  =      -DTPM_POSIX=1   		\
		-DTPM_NV_DISK=1 		\
		-DTPM_MAXIMUM_KEY_SIZE=4096 	\
		-DTPM_USE_UNIXIO=1 		\
		-DHAVE_HMAC_CTX_CLEANUP=1	\
		-DTPM_V12=1			\
		-DTPM_AES=1 			\
		-DTPM_USE_TAG_IN_STRUCTURE=1 
WARNINGS = -Wall -Wuninitialized -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -W -Werror
CCFLAGS  = -O2 -fPIC $(DEFINES) $(WARNINGS) $(INCLUDE) $(CFLAGS)
ARFLAGS  = rcs
OBJECTS  = \
		auditing.o	\
		bind.o		\
		chgauth.o	\
		context.o	\
		counter.o	\
		daa.o		\
		debug.o		\
		delegation.o	\
		dir.o		\
		eviction.o	\
		hmac.o		\
		identity.o	\
		keys.o		\
		keyswap.o	\
		maintenance.o	\
		management.o	\
		migrate.o	\
		miscfunc.o	\
		nv.o		\
		oiaposap.o	\
		optin.o		\
		owner.o		\
		ownertpmdiag.o	\
		pcrs.o		\
		raw.o		\
		rng.o		\
		seal.o		\
		serialize.o	\
		session.o	\
		sha.o		\
		signature.o	\
		startup.o	\
		testing.o	\
		ticks.o		\
		tpmutil.o	\
		transport.o	\
		tpm_interface.o

OUTPUT   = libtpm.a

.SILENT:
all: $(OUTPUT)

%.o: %.c
	echo "    [CC] $<"
	$(CC) $(CCFLAGS) -c $<

$(OUTPUT): $(OBJECTS)
	echo "    [AR] $(OBJECTS) -> $(OUTPUT)"
	$(AR) $(ARFLAGS) $(OUTPUT) $(OBJECTS)

.PHONY: clean
clean:
	echo "    [RM] $(OBJECTS) $(OUTPUT)"
	rm -f $(OBJECTS) $(OUTPUT)



