Mail Archives: djgpp/1994/03/17/19:00:20
Hi,
Mark wrote:
> Is there any way to generate a response file in GNU make when a variable
> is > 128 characters? For example, if I have
> OBJS = file1.c file2.c file3.c file4.c \
> ...
> file99.c
> I can't just do an "echo $(OBJS) > cmdline.tmp", since only the first 128
> characters of that command will be processed. Is there a simple solution to
> this problem?
Some people already pointed out that this problem is gone if you
use D.J.'s port of gnu make 3.70, which is part of DJGPP 1.11.
Unfortunately, I was not able to use gnu make 3.70 (is VERY slow
on startup if I have a large makfile and aborts with "out of
memory" message), so I'm still left with Thorsten Ohls quite old
port of gnu make 3.58. This port was done using the "swapping library"
(swalib) of the same author; part of this library is the possibility
of automatic putting argv into environment variables _ARGV0, _ARGV1,...
The nice thing is now, that all DJGPP-compiled programs as well as
the binaries if DJGPP itself understand this convention; if you
use gcc and ar with long argument lists, you have to put a line
LONGARGS=gcc:ar
into your makefile to let make know that gcc and ar accept
arguments via environment.
If you have other programs which need response files and don't
accept environment args, you could use the simple "mkrf"
program, which must be djgpp - compiled and consequently
gets its argument from the environment, if you include it
in the above LONGARGS definition.
/*
*
* 1992 by Dirk Zabel
*
* usage: mkrf <File> { <word> }
*/
#include <stdio.h>
#include <stdlib.h>
int main(argc, argv)
int argc;
char ** argv;
{ int i;
FILE * fp;
if (argc < 2) {
fprintf(stderr,"usage: %s <File> word ...n", argv[0]);
exit(2);
}
fp=fopen(argv[1], "w");
if (!fp) {
fprintf(stderr, "%s: can't open %s for output\n", argv[0], argv[1]);
exit(3);
}
for (i=2; i<argc; i++) {
fprintf(fp, "%s\n", argv[i]);
}
fclose(fp);
}
The trick is that mkrf gets the output-file name directly and
there is no need to use output redirection.. if there is
anything more complex than a simple program name with
args, gnuish make 3.58 uses command.com (btw, this make
is 4dos-aware, if you put a line "SHELL=4dos" into your makefile).
This means that you cannot have long argument lists together
with wildcard arguments, pipes or i/o redirection.
Some other problem with gnuish make 3.58 is, that it was ported
with microsoft C 6.0 in mind; it has special support for fully
automatic generating response files for microsoft link, but
has NOT the standard suffix-list (doesn't know .o but .obj instead)
nor the standard rule-set or variables ($(CC)=cl !!!). So what
I do is put a line "include $(GMAKEINI)" into each makefile and
have an environment variable GMAKEINI, which points to my
file gmake.ini:
#
# use gnuish make 3.58 together with DJGPP
# this is just a starting point, needs more rules...
LONGARGS = gcc:ld:ar
CC = gcc
CFLAGS =
LFLAGS = -8
LEX.l = $(LEX) $(LFLAGS)
.SUFFIXES:
.SUFFIXES: .c .cc .o .h .exe .y .l
%.exe : %
out2exe $*
%.o : %.c
$(CC) $(CFLAGS) -c $<
%.o : %.cc
$(CC) $(CFLAGS) -c $<
% : %.o
$(CC) -o $@ $< $(LDFLAGS)
Ok, enough; hope this helps
Dirk
- Raw text -