Hi!

Sorry, $(LDFLAGS) are those used by the linker ("LoaDer"), while $(OPTFLAGS) 
are those used for OPTimization in the compiler. $(OPTFLAGS) should be a part 
of $(CFLAGS), the options passed to the C compiler. Depending on the default 
rules, $(LDFLAGS) don't need to be part of $(CFLAGS).

With "make -p" you can print the database (default rules) for GNU make:
LINK.c = $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)
COMPILE.c = $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c

So there's no need to add $(LDFLAGS) to $(CFLAGS) (if the rules in Makefile are 
OK)

LINK.cc = $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)
LINK.S = $(CC) $(ASFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_MACH)
LINK.c = $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)
LINK.s = $(CC) $(ASFLAGS) $(LDFLAGS) $(TARGET_MACH)
LINK.o = $(CC) $(LDFLAGS) $(TARGET_ARCH)
LINK.cpp = $(LINK.cc)
LINK.o = $(CC) $(LDFLAGS) $(TARGET_ARCH)
LINK.F = $(FC) $(FFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)
LINK.f = $(FC) $(FFLAGS) $(LDFLAGS) $(TARGET_ARCH)

        $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
        $(LINK.c) $^ $(LOADLIBES) $(LDLIBS) -o $@
        $(LINK.cc) $^ $(LOADLIBES) $(LDLIBS) -o $@
        $(LINK.C) $^ $(LOADLIBES) $(LDLIBS) -o $@
        $(LINK.cpp) $^ $(LOADLIBES) $(LDLIBS) -o $@
        $(LINK.s) $^ $(LOADLIBES) $(LDLIBS) -o $@
        $(LINK.S) $^ $(LOADLIBES) $(LDLIBS) -o $@

Regards,
Ulrich

>>> Foo Bar <[email protected]> schrieb am 07.09.2011 um 21:09 in Nachricht
<d315063d-4067-4a9c-8711-546f0c0f5...@bl1g2000vbb.googlegroups.com>:
> Hi,
> 
> > > -CFLAGS += $(OPTFLAGS) -O2 -fno-inline -Wall -Wstrict-prototypes -g
> > > +CFLAGS += $(OPTFLAGS) $(LDFLAGS) -Wall -Wstrict-prototypes -g
> >
> > Now $(LDFLAGS) are duplicated, right?
> >
> > Ulrich
> 
> I am really bad at this. (: It's all good now, I hope.
> 
> diff --git a/usr/Makefile b/usr/Makefile
> index 3ee0cb4..dcf78c2 100644
> --- a/usr/Makefile
> +++ b/usr/Makefile
> @@ -30,7 +30,7 @@ DCB_OBJ=
>  endif
>  endif
> 
> -OPTFLAGS ?= -O2 -g
> +OPTFLAGS ?= -O2 -g -fno-inline $(LDFLAGS)
>  WARNFLAGS ?= -Wall -Wstrict-prototypes
>  CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -I../include -I. -I../utils/open-
> isns \
>                                         -D$(OSNAME) $(IPC_CFLAGS)
> diff --git a/utils/Makefile b/utils/Makefile
> index 2c7e891..79c6f8e 100644
> --- a/utils/Makefile
> +++ b/utils/Makefile
> @@ -1,6 +1,6 @@
>  # This Makefile will work only with GNU make.
> 
> -CFLAGS += $(OPTFLAGS) -O2 -fno-inline -Wall -Wstrict-prototypes -g
> +CFLAGS += $(OPTFLAGS) -Wall -Wstrict-prototypes -g
>  PROGRAMS = iscsi-iname
> 
>  all: $(PROGRAMS)
> diff --git a/utils/fwparam_ibft/Makefile b/utils/fwparam_ibft/Makefile
> index ca07b76..9276722 100644
> --- a/utils/fwparam_ibft/Makefile
> +++ b/utils/fwparam_ibft/Makefile
> @@ -28,7 +28,7 @@ CLEANFILES = $(OBJS) *.output *~
> 
>  OPTFLAGS ?= -O2 -g -fPIC
>  WARNFLAGS ?= -Wall -Wstrict-prototypes
> -CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -I../../include -I../../usr
> +CFLAGS += $(OPTFLAGS) $(LDFLAGS) $(WARNFLAGS) -I../../include -I../../
> usr
> 
>  all: $(OBJS)



 

-- 
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.

Reply via email to