Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Mar 1998 17:17:23 -0500 (EST)
From:      shmit@kublai.com
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   bin/6178: BSD Makefile patches for Objective C
Message-ID:  <199803302217.RAA07235@natasya.kublai.com>

next in thread | raw e-mail | index | archive | help

>Number:         6178
>Category:       bin
>Synopsis:       Patches for Objective C compilation with BSD makefiles.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Mar 30 14:20:01 PST 1998
>Last-Modified:
>Originator:     Brian Cully
>Organization:
None
>Release:        FreeBSD 3.0-CURRENT i386
>Environment:

>Description:
	The patches enable you to compile Objective C code as you would
	C++ or C code without jumping through hoops in /etc/make.conf or
	Makefile.

	-Wno-import is not my call to make. I put it in there because
	I felt that most Objective C users would come from a NeXT background
	and would use #import. For all I care, those people can tack it
	onto CFLAGS.

>How-To-Repeat:


>Fix:
diff -cr mk.orig/bsd.dep.mk mk.new/bsd.dep.mk
*** mk.orig/bsd.dep.mk	Mon Mar 30 14:15:48 1998
--- mk.new/bsd.dep.mk	Mon Mar 30 15:37:24 1998
***************
*** 55,60 ****
--- 55,65 ----
  	    ${CXXFLAGS:M-nostdinc*} ${CXXFLAGS:M-[BID]*} \
  	    ${.ALLSRC:M*.cc} ${.ALLSRC:M*.C} ${.ALLSRC:M*.cxx}
  .endif
+ .if ${SRCS:M*.m} != ""
+ 	${MKDEPCMD} -f ${DEPENDFILE} -a ${MKDEP} \
+ 	    ${OBJCFLAGS:M-nostdinc*} ${OBJCFLAGS:M-[BID]*} \
+ 	    ${OBJCFLAGS:M-Wno-import*} ${.ALLSRC:M*.m}
+ .endif
  .if target(_EXTRADEPEND)
  	cd ${.CURDIR}; ${MAKE} _EXTRADEPEND
  .endif
diff -cr mk.orig/bsd.lib.mk mk.new/bsd.lib.mk
*** mk.orig/bsd.lib.mk	Mon Mar 30 14:15:48 1998
--- mk.new/bsd.lib.mk	Mon Mar 30 15:43:06 1998
***************
*** 27,32 ****
--- 27,35 ----
  .if defined(DESTDIR)
  CFLAGS+= -I${DESTDIR}/usr/include
  CXXINCLUDES+= -I${DESTDIR}/usr/include/g++
+ OBJCINCLUDES+= -I${DESTDIR}/usr/include/objc
+ .else
+ OBJCINCLUDES+= -I/usr/include/objc
  .endif
  
  .if defined(DEBUG_FLAGS)
***************
*** 70,75 ****
--- 73,90 ----
  
  .cc.so .C.so .cxx.so:
  	${CXX} ${PICFLAG} -DPIC ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
+ 	@${LD} -O ${.TARGET} -x -r ${.TARGET}
+ 
+ .m.o:
+ 	${OBJC} ${OBJCFLAGS} -c ${.IMPSRC} -o ${.TARGET}
+ 	@${LD} -O ${.TARGET} -x -r ${.TARGET}
+ 
+ .m.po:
+ 	${OBJC} -pg ${OBJCFLAGS} -c ${.IMPSRC} -o ${.TARGET}
+ 	@${LD} -O ${.TARGET} -X -r ${.TARGET}
+ 
+ .m.so:
+ 	${OBJC} ${OBJCFLAGS} -DPIC ${OBJCFLAGS} -c ${.IMPSRC} -o ${.TARGET}
  	@${LD} -O ${.TARGET} -x -r ${.TARGET}
  
  .f.o:
diff -cr mk.orig/bsd.libnames.mk mk.new/bsd.libnames.mk
*** mk.orig/bsd.libnames.mk	Mon Mar 30 14:15:48 1998
--- mk.new/bsd.libnames.mk	Mon Mar 30 15:40:56 1998
***************
*** 43,48 ****
--- 43,49 ----
  LIBMYTINFO?=	${DESTDIR}/usr/lib/libmytinfo.a
  LIBNCURSES?=	${DESTDIR}/usr/lib/libncurses.a
  LIBOPIE?=	${DESTDIR}/usr/lib/libopie.a
+ LIBOBJC?=	${DESTDIR}/usr/lib/libobjc.a
  LIBPC?=		${DESTDIR}/usr/lib/libpc.a	# XXX doesn't exist
  LIBPCAP?=	${DESTDIR}/usr/lib/libpcap.a
  LIBPLOT?=	${DESTDIR}/usr/lib/libplot.a	# XXX doesn't exist
diff -cr mk.orig/bsd.prog.mk mk.new/bsd.prog.mk
*** mk.orig/bsd.prog.mk	Mon Mar 30 14:15:48 1998
--- mk.new/bsd.prog.mk	Mon Mar 30 15:39:06 1998
***************
*** 8,19 ****
  # Default executable format
  BINFORMAT?=	aout
  
! .SUFFIXES: .out .o .c .cc .cxx .C .y .l .s .S
  
  CFLAGS+=${COPTS} ${DEBUG_FLAGS}
  .if defined(DESTDIR)
  CFLAGS+= -I${DESTDIR}/usr/include
  CXXINCLUDES+= -I${DESTDIR}/usr/include/g++
  .endif
  
  .if !defined(DEBUG_FLAGS)
--- 8,22 ----
  # Default executable format
  BINFORMAT?=	aout
  
! .SUFFIXES: .out .o .c .cc .cxx .m .C .y .l .s .S
  
  CFLAGS+=${COPTS} ${DEBUG_FLAGS}
  .if defined(DESTDIR)
  CFLAGS+= -I${DESTDIR}/usr/include
  CXXINCLUDES+= -I${DESTDIR}/usr/include/g++
+ OBJCINCLUDES+= -I${DESTDIR}/usr/include/objc
+ .else
+ OBJCINCLUDES+= -I/usr/include/objc
  .endif
  
  .if !defined(DEBUG_FLAGS)
***************
*** 22,27 ****
--- 25,35 ----
  
  .if defined(NOSHARED) && ( ${NOSHARED} != "no" && ${NOSHARED} != "NO" )
  LDFLAGS+= -static
+ .endif
+ 
+ # If Objective C sources are included, make sure we link with -lobjc.
+ .if ${SRCS:M*.m}
+ LDADD+=	-lobjc
  .endif
  
  .if defined(PROG)
diff -cr mk.orig/sys.mk mk.new/sys.mk
*** mk.orig/sys.mk	Mon Mar 30 14:15:48 1998
--- mk.new/sys.mk	Mon Mar 30 15:38:00 1998
***************
*** 15,21 ****
  .if defined(%POSIX)
  .SUFFIXES:	.o .c .y .l .a .sh .f
  .else
! .SUFFIXES:	.out .a .ln .o .c .cc .cxx .C .F .f .e .r .y .l .S .s .cl .p .h .sh
  .endif
  
  .LIBS:		.a
--- 15,21 ----
  .if defined(%POSIX)
  .SUFFIXES:	.o .c .y .l .a .sh .f
  .else
! .SUFFIXES:	.out .a .ln .o .c .cc .cxx .m .C .F .f .e .r .y .l .S .s .cl .p .h .sh
  .endif
  
  .LIBS:		.a
***************
*** 43,48 ****
--- 43,51 ----
  CXX		?=	c++
  CXXFLAGS	?=	${CXXINCLUDES} ${CFLAGS}
  
+ OBJC		?=	cc
+ OBJCFLAGS	?=	${OBJCINCLUDES} ${CFLAGS} -Wno-import
+ 
  CPP		?=	cpp
  
  .if ${.MAKEFLAGS:M-s} == ""
***************
*** 184,189 ****
--- 187,195 ----
  
  .cc.o .cxx.o .C.o:
  	${CXX} ${CXXFLAGS} -c ${.IMPSRC}
+ 
+ .m.o:
+ 	${OBJC} ${OBJCFLAGS} -c ${.IMPSRC}
  
  .p.o:
  	${PC} ${PFLAGS} -c ${.IMPSRC}
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199803302217.RAA07235>