# compilation settings

libNGStreams_INCLUDE_DIRS += \
	-I$(GNUSTEP_TARGET_CPU)/$(GNUSTEP_TARGET_OS) \
	-INGStreams		\
	-I../NGExtensions	\
	-I..

NGStreams_INCLUDE_DIRS += $(libNGStreams_INCLUDE_DIRS)


# dependencies

libNGStreams_LIBRARIES_DEPEND_UPON += \
	-lNGExtensions -lEOControl	\
	-lDOM -lSaxObjC			\
	-lz
NGStreams_LIBRARIES_DEPEND_UPON += \
	-framework NGExtensions -framework EOControl	\
	-framework DOM -framework SaxObjC		\
	-lz


# library/framework search pathes

DEP_DIRS = \
	../NGExtensions	\
	../EOControl	\
	../../sope-xml/DOM ../../sope-xml/SaxObjC

ifneq ($(frameworks),yes)
ADDITIONAL_LIB_DIRS += \
	$(foreach dir,$(DEP_DIRS),\
	  -L$(GNUSTEP_BUILD_DIR)/$(dir)/$(GNUSTEP_OBJ_DIR_NAME))
else
ADDITIONAL_LIB_DIRS += \
	$(foreach dir,$(DEP_DIRS),-F$(GNUSTEP_BUILD_DIR)/$(dir))
endif

SYSTEM_LIB_DIR += -L/usr/local/lib -L/usr/lib


# activating SSL support
ifneq ($(ssl),no)
libNGStreams_OBJC_FILES += NGActiveSSLSocket.m
NGStreams_OBJC_FILES += NGActiveSSLSocket.m
ADDITIONAL_CPPFLAGS += -DHAVE_OPENSSL=1 -DOPENSSL_NO_KRB5
libNGStreams_LIBRARIES_DEPEND_UPON += -lssl -lcrypto
NGStreams_LIBRARIES_DEPEND_UPON += -lssl -lcrypto
endif

ADDITIONAL_CPPFLAGS += -Wall -Wno-protocol

# reentrant

ifeq ($(reentrant),yes)
ADDITIONAL_CPPFLAGS += -D_REENTRANT=1
endif

# Apple

ifeq ($(FOUNDATION_LIB),apple)
libNGStreams_PREBIND_ADDR="0xC1400000"
libNGStreams_LDFLAGS += -seg1addr $(libNGStreams_PREBIND_ADDR)
NGStreams_LDFLAGS += -seg1addr $(libNGStreams_PREBIND_ADDR)
endif

# Windows

ifeq ($(GNUSTEP_TARGET_OS),mingw32)
libNGStreams_LIBRARIES_DEPEND_UPON += -lFoundation -lobjc
endif
ifeq ($(GNUSTEP_TARGET_OS),cygwin32)
libNGStreams_LIBRARIES_DEPEND_UPON += -lFoundation -lobjc
endif