Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Mar 1998 15:06:51 -0500 (EST)
From:      Chuck Robey <chuckr@glue.umd.edu>
To:        Brian Cully <shmit@kublai.com>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: Objective C rules for /usr/share/mk
Message-ID:  <Pine.BSF.3.96.980330150029.12625A-100000@localhost>
In-Reply-To: <19980330143431.00467@kublai.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 30 Mar 1998, Brian Cully wrote:

> I've been tweaking around in /usr/share/mk that I might make Objective
> C programs with BSD make.
> 
> The way things stand now, I have to add the following rules whenever
> I want to put together an ObjC program:
> 
> CFLAGS=	-I/usr/include/objc -Wno-import
> LDADD=	-lobjc
> 
> .SUFFIXES: .m
> .m.o:
> 	$(CC) $(CFLAGS) -c $<

Brian, you might not be aware that the make utility has compiled into it
to read the startup file /usr/share/mk/sys.mk, but you're really not
supposed to modify that.  sys.mk sources in /etc/make.conf, and that's
(/etc/make.conf) where local user modifications are expected to go.

That's probably the source of some of the things you mentioned, that you
supposed were compiled in.  Take a look at /etc/make.conf, and customize
to your hearts' content, but please leave sys.mk entirely alone
(especially if you ever intend to compile the FreeBSD source tree).

BTW, reading the files in /usr/share/mk is a good way to really learn
makefile hacking.  I'd recommend spending some time with bsd.port.mk.
It's a real nest of every type of contortion possible ... not an example
of beautiful makefiles, but a rich example of how to do fancy things
with makefiles, and well worth some occaisonal browsing.

> 
> I'd like to be able to strip those out entirely. I've managed to do
> so by some makefile hacking in share/mk, but I'm not sure if it's the
> right approach.
> 
> The way things stand now, it looks as though the makefiles depend on
> some hard-coded behaviour in `make' and `cc'. Namely that `make' knows
> the default for compiling object files of various types, and that
> `cc' knows the appropriate include paths and links with the appropriate
> library at the linker step.
> 
> The only place this isn't the case is in sys.mk, and I feel as though
> my patches will work just fine for that.
> 
> One of the obvious problems with the patches I've made is that I've
> put the rules for .m.o in bsd.prog.mk, which doesn't seem appropriate,
> as I feel it's applicable for bsd.lib.mk as well, and there ought to
> be a place where I can define it once and not have to worry about it
> again.
> 
> I've also defined the following variables:
> OBJC:		the Objective C compiler
> OBJCINCLUDES:	the include path for Objective C headers
> OBJCLIBS:	libraries with which to link.
> 
> These are all at the top of bsd.prog.mk, and once again, I don't feel
> as though they belong there.
> 
> The patches are attached.
> 
> -- 
> Brian Cully						<shmit@erols.com>
> ``And when one of our comrades was taken prisoner, blindfolded, hung
>   upside-down, shot, and burned, we thought to ourselves, `These are the
>   best experiences of our lives''' -Pathology (Joe Frank, Somewhere Out There)
> 

----------------------------+-----------------------------------------------
Chuck Robey                 | Interests include any kind of voice or data 
chuckr@glue.umd.edu         | communications topic, C programming, and Unix.
213 Lakeside Drive Apt T-1  |
Greenbelt, MD 20770         | I run Journey2 and picnic, both FreeBSD
(301) 220-2114              | version 3.0 current -- and great FUN!
----------------------------+-----------------------------------------------





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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.980330150029.12625A-100000>