delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/06/24/22:30:19

Message-ID: <3953D200.897086E1@pacbell.net>
From: Wesel <nospam AT pacbell DOT net>
X-Mailer: Mozilla 4.73 [en] (Win98; I)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Make file wildcards
References: <395309A1 DOT 881A2311 AT pacbell DOT net> <200006230948 DOT MAA02794 AT mailgw1 DOT netvision DOT net DOT il>
Lines: 122
Date: Fri, 23 Jun 2000 14:09:20 -0700
NNTP-Posting-Host: 63.197.122.98
X-Complaints-To: abuse AT pacbell DOT net
X-Trace: news.pacbell.net 961794222 63.197.122.98 (Fri, 23 Jun 2000 14:03:42 PDT)
NNTP-Posting-Date: Fri, 23 Jun 2000 14:03:42 PDT
Organization: SBC Internet Services
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Eli Zaretskii wrote:
> 
> 
> > I built my makefile as follows:
> >
> > --------------------------------------------------------
> > CC = gcc
> > CFLAGS = -g
> > OBJECTS = test.o
> >
> > main.exe : $(OBJECTS)
> >       $(CC) $(CFLAGS) $(OBJECTS) -o main.exe
> >
> > %.o : %.c %.cpp %.h
> >       $(CC) $(CFLAGS) -c $<
> > --------------------------------------------------------
> >
> > My hopes were that upon discovering a modified .cpp file, make would
> > compile test.o then, finding a modified (created) test.o file, it would
> > build main.exe from the object file.  The makefile compiled fine, but it
> > used a sneaky implicit rule.  Apparantly %.o : %.cpp is built-in, so
> > what I saw was
> >
> > --------------------------------------------------------
> > make -k
> > gpp    -c -o test.o test.cpp
> > gcc -g test.o -o main.exe
> 
> This is expected behavior.  As written, the implicit rule you used
> is just another implicit rule, not unlike the one that Make already
> knows about.  When Make sees more than one implicit rule to build the
> same target, it chooses the first one, which will always be the one
> that's built into Make.
> 
> Lesson no.1: do not use implicit rules if Make already has a built-in
> rule for that case.  Instead, tailor the existing implicit rule to
> your need by changing the variables used by that rule, such as CC,
> CXX, CXXFLAGS, etc.

I tried using the built in rules, and it worked!  My problem before was
compiling a .cpp file but only modifying the CFLAGS variable.  CPPFLAGS
put the proper debugging flags in.
 
> To get Make do what you want, use a static pattern rule instead of an
> implicit rule, like this:
> 
> $(OBJECTS):  %.o : %.c %.cpp %.h

This did confuse me.  It didn't work, probably because I didn't
understand.  A rule within a rule?  Or perhaps you meant

$(OBJECTS): %.c %.cpp %.h

Which almost worked.  I was happier modifying CPPFLAGS in the end.
 
> The addition of "$(OBJECTS)" makes all the difference you need.  For
> more about this, read the node "Static versus Implicit" in the Make
> manual.

Whew.  I looked at that section again, this time using the *correct*
info file.  It was very informative.  Thank you.

> > Compilation finished at Thu Jun 22 20:29:34
> 
> Kudos on using Emacs ;-)

^.^  I just got started with it.  It's a wonderful program, but so
bug-ridden
on Windows 98!  I still haven't figured out what it meant when I went
'M-x
compile' and the output hung leaving nasty windowless processes all over
my system.  I might as well mention this, since it looks like there's
someone (not me certainly!) who understands Emacs here.

The Windows port uses this funny program called 'cmdproxy.exe' instead
of plain ol' command.com to execute DOS shell commands.  I think that's
the root of the problem (3rd party software and all) but I'm afraid to
try to redirect Emacs to do something like 'command.com /c'

'M-x compile' followed by 'make' sporadically produces the result
------------------------------------------------------
make

warning: extra args ignored after
'C:\WINDOWS\DESKTOP\TCL\EMACS\EMACS-20.7\BIN\CMDPROXY.EXE'


Microsoft(R) Windows 98
   (C)Copyright Microsoft Corp 1981-1999.

C:\WINDOWS\Desktop\tcl\emacs\emacs-20.7\projects>
------------------------------------------------------

Then, I'm left with two new processes (cmdproxy and winoldap) that not
even ctrl-alt-delete can cancel!  They stop responding even to the 'End
Task' dialog box.  The only solution I've found is a complete reboot. 
When enough of these processes start stacking up, Emacs does very weird
things.

I did find that from a DOS command prompt, djgpp's make works perfectly
on my makefile, but I would rather do everything in Emacs.  If you have
any ideas what I'm doing wrong, I'd be happy to hear them.  If not...
thanks for letting me rant a bit.  I feel much better now.

> > Is there any way I can use wildcards with the make utility provided by
> > djgpp?
> 
> Yes, you can, but I'm not sure in what context would you need that, so
> I cannot give specific advice.  You may wish to read the node
> "Wildcards" in the Make manual.

I did read this.  Sorry for being unclear.  I meant wildcards in the
context of the type-symbols make uses to generate implicit rules.  Using
wildcards such as *.o might work too.  I think I'll stay with modifying
CPPFLAGS unless there's a need for me to change.


Wesel

-- 
To send me an email, just replace the @ and the .
     -----wassdamo at pacbell dot net

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019