www.digitalmars.com         C & C++   DMDScript  

c++.command-line - make vs. smake

reply Laurentiu Pancescu <plaur crosswinds.net> writes:
Which should I use, smake or make?  Are there any issues
related to using smake, like copyright, or maybe people using the
free version not having it?

smake has a very useful option for inline generating of
response files, with <<.  For example:

OBJS: file1.obj file2.obj

test.exe: $(OBJS)
	sc -o$   <<
$(OBJS)
<<

If I have very many files, the command line limit may be
exceeded, so automatic generation of linker response files, like
above, is very useful.  How can I do this in make?  Not by "echo
file1.obj >> link.lst", or similar, of course...  ;-)


Laurentiu
Sep 08 2001
parent reply "Walter" <walter digitalmars.com> writes:
smake is most useful if you're used to Microsoft nmake. I tend to use make
myself because it is simpler, and I write simple makefiles.

To get make to generate response files:

    foo.exe : foo.obj bar.obj foo.rsp
        link  foo.rsp

    foo.rsp: makefile
        echo foo,foo+ >foo.rsp
        echo bar; >>foo.rsp

Laurentiu Pancescu wrote in message <9ne4v6$d6j$1 digitaldaemon.com>...
Which should I use, smake or make?  Are there any issues
related to using smake, like copyright, or maybe people using the
free version not having it?

smake has a very useful option for inline generating of
response files, with <<.  For example:

OBJS: file1.obj file2.obj

test.exe: $(OBJS)
 sc -o$   <<
$(OBJS)
<<

If I have very many files, the command line limit may be
exceeded, so automatic generation of linker response files, like
above, is very useful.  How can I do this in make?  Not by "echo
file1.obj >> link.lst", or similar, of course...  ;-)


Laurentiu

Sep 08 2001
parent reply Laurentiu Pancescu <plaur crosswinds.net> writes:
"Walter" <walter digitalmars.com> wrote:

To get make to generate response files:

    foo.exe : foo.obj bar.obj foo.rsp
        link  foo.rsp

    foo.rsp: makefile
        echo foo,foo+ >foo.rsp
        echo bar; >>foo.rsp

I already knew about this solution, it's widely used (NASM makefile for lcc-win32 uses it, for example: they even have a cute comment about repeated spawning of COMMAND.COM slowing things down :) - thanks anyway! The problem I encountered is with V, which needs to call LIB. Unfortunately, the echo approach doesn't work in this case: LIB response files want & as a continuation character, and you just can't create this with echo! '&' seems to have some special meaning to MS shell (at least Win2k's CMD.EXE), and I wasn't able to produce it in an echo-ed file (not with %&, \&, &&, nothing helped). Would it be a too much effort to add SMAKE style automatic file generation to your MAKE? Borland's MAKE also has it, and I think it's a nice feature. Of course, I could use SMAKE, but it happens that I like your MAKE better... ;) Regards, Laurentiu
Sep 10 2001
parent reply Jan Knepper <jan smartsoft.cc> writes:
I think the & problem can be fixed by prefixing them with ^, thus use
^&
(That's what I vaguely remember)

Jan



Laurentiu Pancescu wrote:

 "Walter" <walter digitalmars.com> wrote:

To get make to generate response files:

    foo.exe : foo.obj bar.obj foo.rsp
        link  foo.rsp

    foo.rsp: makefile
        echo foo,foo+ >foo.rsp
        echo bar; >>foo.rsp

I already knew about this solution, it's widely used (NASM makefile for lcc-win32 uses it, for example: they even have a cute comment about repeated spawning of COMMAND.COM slowing things down :) - thanks anyway! The problem I encountered is with V, which needs to call LIB. Unfortunately, the echo approach doesn't work in this case: LIB response files want & as a continuation character, and you just can't create this with echo! '&' seems to have some special meaning to MS shell (at least Win2k's CMD.EXE), and I wasn't able to produce it in an echo-ed file (not with %&, \&, &&, nothing helped). Would it be a too much effort to add SMAKE style automatic file generation to your MAKE? Borland's MAKE also has it, and I think it's a nice feature. Of course, I could use SMAKE, but it happens that I like your MAKE better... ;) Regards, Laurentiu

Sep 10 2001
next sibling parent reply Laurentiu Pancescu <plaur crosswinds.net> writes:
Jan Knepper <jan smartsoft.cc> wrote:

I think the & problem can be fixed by prefixing them with ^, thus use
^&
(That's what I vaguely remember)

Jan

Thanks, it worked!! :) Laurentiu
Sep 10 2001
parent Jan Knepper <jan smartsoft.cc> writes:
Cool!
I didn't even take drugs to remember it!
Or may be I did remember it because I never took drugs! <g>

Jan



Laurentiu Pancescu wrote:

 Jan Knepper <jan smartsoft.cc> wrote:

I think the & problem can be fixed by prefixing them with ^, thus use
^&
(That's what I vaguely remember)

Jan

Thanks, it worked!! :) Laurentiu

Sep 11 2001
prev sibling parent reply "Walter" <walter digitalmars.com> writes:
The ^& works in my tests. -Walter

Jan Knepper wrote in message <3B9D0FA7.30F56E7D smartsoft.cc>...
I think the & problem can be fixed by prefixing them with ^, thus use
^&
(That's what I vaguely remember)

Jan



Laurentiu Pancescu wrote:

 "Walter" <walter digitalmars.com> wrote:

To get make to generate response files:

    foo.exe : foo.obj bar.obj foo.rsp
        link  foo.rsp

    foo.rsp: makefile
        echo foo,foo+ >foo.rsp
        echo bar; >>foo.rsp

I already knew about this solution, it's widely used (NASM makefile for lcc-win32 uses it, for example: they even have a cute comment about repeated spawning of COMMAND.COM slowing things down :) - thanks anyway! The problem I encountered is with V, which needs to call LIB. Unfortunately, the echo approach doesn't work in this case: LIB response files want & as a continuation character, and you just can't create this with echo! '&' seems to have some special meaning to MS shell (at least Win2k's CMD.EXE), and I wasn't able to produce it in an echo-ed file (not with %&, \&, &&, nothing helped). Would it be a too much effort to add SMAKE style automatic file generation to your MAKE? Borland's MAKE also has it, and I think it's a nice feature. Of course, I could use SMAKE, but it happens that I like your MAKE better... ;) Regards, Laurentiu


Sep 10 2001
parent reply "Rajiv Bhagwat" <dataflow vsnl.com> writes:
The linker responce file also requires a blank line (for missing additional
libs). How do you get that one?

echo    >> file
echo "" >> file

etc does not work.
- Rajiv

Walter <walter digitalmars.com> wrote in message
news:9njsqd$iis$2 digitaldaemon.com...
 The ^& works in my tests. -Walter

 Jan Knepper wrote in message <3B9D0FA7.30F56E7D smartsoft.cc>...
I think the & problem can be fixed by prefixing them with ^, thus use
^&
(That's what I vaguely remember)

Jan



Laurentiu Pancescu wrote:

 "Walter" <walter digitalmars.com> wrote:

To get make to generate response files:

    foo.exe : foo.obj bar.obj foo.rsp
        link  foo.rsp

    foo.rsp: makefile
        echo foo,foo+ >foo.rsp
        echo bar; >>foo.rsp

I already knew about this solution, it's widely used (NASM makefile for lcc-win32 uses it, for example: they even have a cute comment about repeated spawning of COMMAND.COM slowing things down :) - thanks anyway! The problem I encountered is with V, which needs to call LIB. Unfortunately, the echo approach doesn't work in this case: LIB response files want & as a continuation character, and you just can't create this with echo! '&' seems to have some special meaning to MS shell (at least Win2k's CMD.EXE), and I wasn't able to produce it in an echo-ed file (not with %&, \&, &&, nothing helped). Would it be a too much effort to add SMAKE style automatic file generation to your MAKE? Borland's MAKE also has it, and I think it's a nice feature. Of course, I could use SMAKE, but it happens that I like your MAKE better... ;) Regards, Laurentiu



Sep 11 2001
parent reply "Walter" <walter digitalmars.com> writes:
Just use a comma, not a blank line. -Walter

Rajiv Bhagwat wrote in message <9nkf33$tpm$1 digitaldaemon.com>...
The linker responce file also requires a blank line (for missing additional
libs). How do you get that one?

echo    >> file
echo "" >> file

etc does not work.
- Rajiv

Walter <walter digitalmars.com> wrote in message
news:9njsqd$iis$2 digitaldaemon.com...
 The ^& works in my tests. -Walter

 Jan Knepper wrote in message <3B9D0FA7.30F56E7D smartsoft.cc>...
I think the & problem can be fixed by prefixing them with ^, thus use
^&
(That's what I vaguely remember)

Jan



Laurentiu Pancescu wrote:

 "Walter" <walter digitalmars.com> wrote:

To get make to generate response files:

    foo.exe : foo.obj bar.obj foo.rsp
        link  foo.rsp

    foo.rsp: makefile
        echo foo,foo+ >foo.rsp
        echo bar; >>foo.rsp

I already knew about this solution, it's widely used (NASM makefile for lcc-win32 uses it, for example: they even have a cute comment about repeated spawning of COMMAND.COM slowing things down :) - thanks anyway! The problem I encountered is with V, which needs to call LIB. Unfortunately, the echo approach doesn't work in this case: LIB response files want & as a continuation character, and you just can't create this with echo! '&' seems to have some special meaning to MS shell (at least Win2k's CMD.EXE), and I wasn't able to produce it in an echo-ed file (not with %&, \&, &&, nothing helped). Would it be a too much effort to add SMAKE style automatic file generation to your MAKE? Borland's MAKE also has it, and I think it's a nice feature. Of course, I could use SMAKE, but it happens that I like your MAKE better... ;) Regards, Laurentiu




Sep 11 2001
parent reply "Rajiv Bhagwat" <dataflow vsnl.com> writes:
Ha! That one worked. ;) Cheating the linker with 2 non-existing libraries,
uh?
Thanks.

For record, I could use the 'echo' for creating detail lines for IMPORTS
section of a .def file, (these lines start with spaces or tabs) as echo just
eats up the first space and copies everything out.

With 'echo' being an in-built command, I guess this has to be the portable
(and efficient) way of creating uniform makefiles. All these days I was
using an ancient Borland 'maker' for sc projects, with yet another way for
creating response files.
Thanks for all the clarifications.
-- Rajiv
Oh: It looks like 'echo' is not always a built in command for 'make', some
versions use the shell?


Walter <walter digitalmars.com> wrote in message
news:9nl9o2$1cbd$1 digitaldaemon.com...
 Just use a comma, not a blank line. -Walter

Sep 11 2001
parent "Walter" <walter digitalmars.com> writes:
In MAKE, the echo command is implemented with system().

Rajiv Bhagwat wrote in message <9nmtnq$27vs$1 digitaldaemon.com>...
Ha! That one worked. ;) Cheating the linker with 2 non-existing libraries,
uh?
Thanks.

For record, I could use the 'echo' for creating detail lines for IMPORTS
section of a .def file, (these lines start with spaces or tabs) as echo

eats up the first space and copies everything out.

With 'echo' being an in-built command, I guess this has to be the portable
(and efficient) way of creating uniform makefiles. All these days I was
using an ancient Borland 'maker' for sc projects, with yet another way for
creating response files.
Thanks for all the clarifications.
-- Rajiv
Oh: It looks like 'echo' is not always a built in command for 'make', some
versions use the shell?


Walter <walter digitalmars.com> wrote in message
news:9nl9o2$1cbd$1 digitaldaemon.com...
 Just use a comma, not a blank line. -Walter


Sep 12 2001