delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/06/19/06:20:52

From: Eric Backus <ericb AT lsid DOT hp DOT com>
Subject: Re: make ALL?
To: djgpp AT sun DOT soe DOT clarkson DOT edu (djgpp)
Date: Sun, 19 Jun 94 2:47:27 PDT
Mailer: Elm [revision: 70.85]

> DOS-based make programs usually have a command line flag "full build" ie. 
> execute all commands disregarding timestamps. This is used for instance 
> when one changes compiler or linker flags. I use it quite often for 
> switching between debug and release builds. Gmake doesn't have this flag (or 
> if it does, it isn't documented). I assume that's because with U*x shells 
> the same effect can easily be achieved by doing something like
> 
> ALL:
> 	touch $(SOURCES)
> 	$(MAKE)
> 
> ALAS, this won't work in DOS if the SOURCES list is moderately long, 
> because of the justly infamous command-line limitation. Now I have tried 
> to think of millions of ways around this, but there's always a catch. In 
> particular I cannot use foreach because the expansion string for foreach 
> can't contain a newline, and DOS can't take multiple commands on a single 
> line.

A few ideas...

A. If you often change the Makefile, then you could put a dependancy
   for this into the Makefile:

   $(OBJS):	Makefile

   Assuming $(OBJS) is the list of .o files that need to be
   recompiled when you change the Makefile, you're all set.

B. If the touch program is a go32 program, then the go32 version of
   GNU make will notice that, and should be able to do the "touch
   $(SOURCES)" line correctly.

C. I don't often see that "touch $(SOURCES)" approach anyway.  It is
   undesirable in that it unnecessarily changes the timestamps of the
   source files.  Instead, most Makefiles have a "clean" target, which
   removes everythings from the directory except the source files.  To
   remake everything, you then do "make clean;make", or perhaps even
   "make clean all".  The Makefile rule for "clean" usually looks
   something like this:

   clean:
	rm -f prog prog.exe *.o *~

D. Even on unix, there is generally a limit to the length of the
   command line.  Generally, this is not an issue because it's usually
   many Kbytes.  But unix came up with a general way to work around
   the problem anyway, called "xargs".  So, for example, if you can't
   do "touch *.o" because there are too many .o files, you can instead
   do "find . -name '*.o' | xargs touch".  The xargs program chops the
   huge listing up into reasonable chunks, and invokes touch for each
   reasonable chunk.  If you get a DOS version of find and xargs, you
   could maybe use this technique.

E. Get a real operating system, dude.
--
				Eric Backus
				ericb AT lsid DOT hp DOT com
				(206) 335-2495

- Raw text -


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