CFLAGS+=	-I${.CURDIR}
CFLAGS+=	-I${.OBJDIR}
.include "../Makefile.inc"

.PATH: ${GCCDIR}/libobjc
.PATH: ${GCCDIR}/libobjc/objc
.PATH: ${GCCDIR}/gcc
.PATH: ${GCCDIR}/gcc/cp
.PATH: ${GCCDIR}/gcc/objc
.PATH: ${GCCDIR}/libgcc

CFLAGS+=	-I${GCCDIR}/libcpp/include
CFLAGS+=	-I${GCCDIR}/libgcc
CFLAGS+=	-DIN_GCC
CFLAGS+=	-DIN_TARGET_LIBS
CFLAGS+=	-DHAVE_CONFIG_H
CFLAGS+=	-fexceptions
CFLAGS+=	-fno-strict-aliasing

LIB=		objc
SHLIB_MAJOR=	4

THRLIB= 	${.OBJDIR}/../../../../lib/libpthread/libpthread.so
LDADD+= 	${THRLIB}
DPADD+= 	${THRLIB}

# Objective-C source files to compile
OBJC_SOURCE_FILES = \
   NXConstStr.m \
   Object.m \
   Protocol.m \
   accessors.m \
   linking.m

# C source files to compile
C_SOURCE_FILES = \
   class.c \
   encoding.c \
   error.c \
   gc.c \
   hash.c \
   init.c \
   ivars.c \
   memory.c \
   methods.c \
   nil_method.c \
   objc-foreach.c \
   objc-sync.c \
   objects.c \
   protocols.c \
   sarray.c \
   selector.c \
   sendmsg.c \
   thr.c \
   exception.c

SRCS=   ${C_SOURCE_FILES}
SRCS+=  ${OBJC_SOURCE_FILES}
SRCS+=	unwind.h runtime-info.h gthr-default.h

unwind.h: unwind-generic.h
	cp ${.ALLSRC} ${.TARGET}
	
gthr-default.h: gthr-posix.h
	cp ${.ALLSRC} ${.TARGET}

runtime-info.h: 
	echo "" > tmp-runtime.m
	echo "/* This file is automatically generated */" > ${.TARGET}
	${CC} -print-objc-runtime-info -S tmp-runtime.m >> ${.TARGET}
	rm -f tmp-runtime.m tmp-runtime.s

INCS=		NXConstStr.h \
		Object.h \
		Protocol.h \
		message.h \
		objc-decls.h \
		objc-exception.h \
		objc-sync.h \
		objc.h \
		runtime.h \
		thr.h
INCSDIR=	/usr/libdata/gcc${GCCSHORTVER}/objc

CLEANFILES+=	unwind.h runtime-info.h gthr-default.h

.include <bsd.lib.mk>
