A (hopefully) simple make question

David S. Goldberg dsg at mbunix.mitre.org
Fri May 12 03:58:21 AEST 1989


I am trying to find a way to change a macro without having to call the
change on the command line.  In Sun's make, there is a := operator
that allows such changes, but the make in Ultrix 2.3 doesn't have this
feature.  One thing that has worked is to do a recursive make, but
that doesn't seem as clean.  I wonder if the :: operator, which I
unfortunately can't find documented anywhere (the Sun man page has a
little blurb on it, but nothing definitive - nothing in the tutorial
or any of the Ultrix docs mentions it).  I prefer to RTFM, but haven't
been able to find this in any of the manuals I have.

Basically what I want to do is this:

CFLAGS = -I. -O
OBJECTS= *.o # I won't bore you with the real filenames

program: $(OBJECTS)
	cc $(CFLAGS) $(OBJECTS) -o program

debug: # here I want to change CFLAGS to CFLAGS= -I. -g -DDEBUG and
       # force recompilation of the whole thing.  I tried:
	make clean
	make CFLAGS="-I. -g -DDEBUG" program

And that worked.  It seems like there should be a better way.  I
remember a similar question being asked a while ago, but I
unfortunately can't find any of those articles to see if they are
relevant to my problem.

I prefer not to generate a lot of net traffic with what seems (to my
embarassment) a pretty basic problem so please mail any replies to
dsg at mbunix.mitre.org or ...!linus!mbunix!dsg if you use UUCP.

Thanks in advance for any help.

Dave
--------------------------------------------------------------------------
Dave Goldberg	             ARPA: dsg at mitre.org
The Mitre Corporation        UUCP: linus!mbunix!dsg
MS B020
Bedford, MA 01730
617-271-2460



More information about the Comp.unix.questions mailing list