# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
#  This software is the proprietary information of Sun Microsystems, Inc.
#  Use is subject to license terms.
#  
#  Copyright 2004 Sun Microsystems, Inc.  Tous droits rservs.
#  Ce logiciel est proprit de Sun Microsystems, Inc.
#  Distribu par des licences qui en restreignent l'utilisation.
# 
# ident        "@(#)Makefile.distrib 1.5     04/08/05 SMI"
# 

# include any conf files
ROOT_DIR= ../../../..
OS := $(shell uname -s)

MKDIR=mkdir
RM=rm


# Compiled library name:
PROGNAME=test_httpd
#Short library name

# Define the libinstrum stucture from the BUILD_DEST location 

MFWK_LIB_SUNOS_PATH=/opt/SUNWmfwk/lib
MFWK_LIB_LINUX_PATH=/opt/sun/mfwk/lib
NSPR_LIB_SUNOS_PATH=/usr/lib/mps
NSPR_LIB_LINUX_PATH=/opt/sun/private/lib
RT_LINKER_PATH_SUNOS=$(MFWK_LIB_SUNOS_PATH):$(NSPR_LIB_SUNOS_PATH)
RT_LINKER_PATH_LINUX=$(MFWK_LIB_LINUX_PATH):$(NSPR_LIB_LINUX_PATH)

INCLUDE_DIR=$(ROOT_DIR)/include
LIB_DIR=$(ROOT_DIR)/lib


CFLAGS+=-I$(INCLUDE_DIR)   -I/usr/include

LIBS+=-lc -lpthread -lrt -lmfCserver -lhttpd -lmfTimers -lmfTransaction -lmfDiscovery -lmfUtils -lmfRserver 
CFLAGS+=-I$(INCLUDE_DIR) -I../src
LOCAL_LDFLAGS+=-L$(LIB_DIR) -L../src $(LIBS) 
ifeq (${OS}, SunOS)
LOCAL_LDFLAGS+=-L$(NSPR_LIB_SUNOS_PATH) -L$(MFWK_LIB_SUNOS_PATH) -R $(RT_LINKER_PATH_SUNOS)
CC=cc
LD=cc
endif
ifeq (${OS}, Linux)
CC=gcc
LD=gcc
LOCAL_LDFLAGS+=-L$(NSPR_LIB_LINUX_PATH) -L$(MFWK_LIB_SUNOS_PATH) -Wl,-rpath,$(RT_LINKER_PATH_LINUX)  
endif


# List of .c files to compile:
CFILES= test_httpd.c


# List of .o object files to generate:
OFILES=${CFILES:.c=.o}


all:$(PROGNAME) 

%.o: %.c
	$(CC) $(CFLAGS) -c $<

$(PROGNAME):$(PROGNAME).o
	$(LD) -o $@ $< $(LOCAL_LDFLAGS)


clean:
	-$(RM) -rf *.o
	-$(RM) -rf *.a *.so



