delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1992/05/18/14:08:03

From: Eric Backus <ericb AT lsid DOT hp DOT com>
Subject: Re: NDMAKE
To: dj AT ctron DOT com
Date: Mon, 18 May 92 10:45:07 PDT
Cc: williams AT herky DOT cs DOT uiowa DOT edu, djgpp AT sun DOT soe DOT clarkson DOT edu,
dvasaru AT lise DOT unit DOT no
Mailer: Elm [revision: 66.25]
Status: O

> Has gnu make been updated to generic long-command-line handling?
> djgpp often requires this feature.
> 
> DJ
> dj AT ctron DOT com
> Life is a banana.

Gnu make has not been updated as far as I know, but It does have a
method of handling long command lines.

Gnu make can pass long command lines to a program by setting the
environment variable _argc to the number of arguments, _argv0 to the
command name, _argv1 to the first argument, etc.  An arbitrary length
command line can be passed this way, assuming there is enough room to
create the environment variables.  (And I've done this successfully
with a LOT of environment variables.)

Gnu make will only do the above if told to.  To tell Gnu make to do
this, set the LONGARGS variable to a colon-separated list of programs
that can handle long command lines in this way.

Of course, go32 doesn't understand this method of passing command
lines.  I wrote a program called "rungcc", which collects all the
arguments from the environment variables, puts them into a "response
file", and uses system() to call gcc.  In Gnu make, I set "CC" to
"rungcc gcc", and I set "LONGARGS" to "rungcc".  This works well,
allowing a makefile that looks like this:


	LONGARGS	= rungcc
	CC		= rungcc gcc
	CFLAGS		= <very long list of flags and defines>
	OBJS		= <very long list of .o files>
	LIBS		= <very long list of .a files>

	myprog:	$(OBJS)
		$(CC) -o myprog $(OBJS) $(LIBS)

	obj1.o:	obj1.c
		$(CC) $(CFLAGS) -c obj1.c

	obj2.o: obj2.c
		$(CC) $(CFLAGS) -c obj2.c

	<etc, etc>


Try it, you'll like it.
--
				Eric Backus
				ericb%hplsla AT hplabs DOT hp DOT com
				(206) 335-2495

p.s.	If go32 could handle the environment variables directly, we
wouldn't have to use the "rungcc" program, which would be nice.

p.p.s.	I wrote a version of crt0.o which parses the environment
variables and sticks them into argc and argv[].  This works well, but
it doesn't help me with gcc unless I recompile gcc from scratch, which
I don't really want to do.  Unfortunately, "gcc" and possible "ld" are
the only programs that I really need this feature for.

- Raw text -


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