[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Macro question
From: |
Eli Zaretskii |
Subject: |
Re: Macro question |
Date: |
Wed, 09 Dec 2015 18:56:12 +0200 |
> From: Gisle Vanem <address@hidden>
> Date: Wed, 9 Dec 2015 16:19:39 +0100
>
> I have a question regarding a GNU-make macro like this
> (which I use to link a MSVC .dll):
>
> define do_link_DLL
> link $(LDFLAGS) -dll -out:$(1) -implib:$(2) \
> -pdb:$(1:.dll=.pdb) -map:$(1:.dll=.map) $(3) > link.tmp
> cat link.tmp >> $(1:.dll=.map)
> rm -f $(2:.lib=.exp) link.tmp
> endef
>
> Using this as (in a Wireshark makefile):
>
> wiretap.dll: $(WIRETAP_OBJ)
> $(call do_link_DLL,wiretap.dll,wiretap_imp.lib, $^ $(EXTRA_LIBS))
>
> AFAICS, if the 'link' stage fails, the rule continues to the 'cat' + 'rm' part
> regardless. But from gmake's perspective all the commands succeeds (since
> cat+rm returns 0). No?
>
> How can I define my macro for gmake to quit on 'link' error?
> Can the macro be written into a Perl-like:
> exec("link $args") || die "link failed";
>
> If so, how?
The Windows shell understands || and && between 2 commands. I think
you already know that, so I'm quite sure I'm missing something here,
because that's the first thing I'd try.