# [PATCH] Use LDFLAGS instead of ALL_CFLAGS when linking.

2 messages from 2005-10-29 to 2005-10-29. Participants: Andreas Ericsson, H. Peter Anvin.
Thread: https://gitlist.dev/t/2269

## Andreas Ericsson, 2005-10-29 07:30

Subject: [PATCH] Use LDFLAGS instead of ALL_CFLAGS when linking.
Message-ID: <4363250C.8030200@op5.se>
URL: https://gitlist.dev/e/4363250C.8030200%40op5.se

```
The patch says it all really. It lets users specify their own linking 
options and unclutters the build-output somewhat.

index 5b0306d..f547d45 100644
--- a/Makefile
+++ b/Makefile
@@ -360,7 +360,7 @@ git-cherry-pick: git-revert
         $(CC) -o $*.o -c $(ALL_CFLAGS) $<

  git-%$X: %.o $(LIB_FILE)
-       $(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^) $(LIBS)
+       $(CC) -o $@ $(filter %.o,$^) $(LIBS) $(LDFLAGS)

  git-mailinfo$X : SIMPLE_LIB += $(LIB_4_ICONV)
  $(SIMPLE_PROGRAMS) : $(LIB_FILE)


-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

```

## H. Peter Anvin, 2005-10-29 16:24

Subject: Re: [PATCH] Use LDFLAGS instead of ALL_CFLAGS when linking.
Message-ID: <4363A223.4040806@zytor.com>
URL: https://gitlist.dev/e/4363A223.4040806%40zytor.com
In-Reply-To: <4363250C.8030200@op5.se>

```
Andreas Ericsson wrote:
> The patch says it all really. It lets users specify their own linking 
> options and unclutters the build-output somewhat.
> 
> index 5b0306d..f547d45 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -360,7 +360,7 @@ git-cherry-pick: git-revert
>         $(CC) -o $*.o -c $(ALL_CFLAGS) $<
> 
>  git-%$X: %.o $(LIB_FILE)
> -       $(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^) $(LIBS)
> +       $(CC) -o $@ $(filter %.o,$^) $(LIBS) $(LDFLAGS)
> 

Typically $(LDFLAGS) comes before $(LIBS).  This is not insignificant, 
since some people put library seach options into LDFLAGS.

	-hpa

```
