# ------------------------------------------------------------------------------
# Makefile is a gmake file for parsespnego.
#
# usage: gmake [CFG=debug|release] [clean]
#
# Author: Frank Balluffi
#
# Copyright (C) 2002-2005 Frank Balluffi. All rights reserved.
# ------------------------------------------------------------------------------

# Define the environment variable OPENSSLDIR to point to OpenSSL.

CFLAGS = -ansi

PLATFORM = $(shell uname)

ifndef CFG
    CFG = debug
endif

ifeq ($(CFG), debug)
    CFLAGS = -ansi -g -O0
endif

ARCH = $(PLATFORM)-$(CFG)
DIRMADE = $(ARCH)-made

EXE = $(ARCH)/parsespnego

OBJS = $(ARCH)/parsespnego.o

all: $(EXE)

$(EXE): $(OBJS)
	gcc $(OBJS) ../../$(ARCH)/libfbopenssl.a $(OPENSSLDIR)/libcrypto.so -o $@

$(ARCH)/parsespnego.o: parsespnego.c
	gcc -c $(CFLAGS) parsespnego.c -I$(OPENSSLDIR)/include -o $@

$(OBJS): $(DIRMADE)

$(DIRMADE):
	if [ ! -d $(ARCH) ]; then mkdir $(ARCH); fi
	@-echo $(DIRMADE) > $(DIRMADE)

clean:
	rm $(OBJS) $(EXE) $(DIRMADE)
	rmdir $(ARCH)
