Hiya, I've got a patch for the iw program to allow it to compile properly with the --as-needed linker flag. This flag requires that files and libraries are listed in a particular order, with required libraries listed after the functions that call them. The original Makefile for iw adds the libraries to the LDFLAGS variable, which is processed before the OBJS are listed (so the libraries are removed). This patch adds a LIBS variable and applies it after the OBJS variable. For more information on as-needed, please see http://www.gentoo.org/proj/en/qa/asneeded.xml. If you have any problems or issues with the patch, please let me know, thanks... 5:) Mike 5:)
diff --git a/Makefile b/Makefile index df59b51..8a97bae 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ CC ?= "gcc" CFLAGS += -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration `pkg-config --cflags libnl-1` CFLAGS += -O2 -g -LDFLAGS += `pkg-config --libs libnl-1` +LIBS += `pkg-config --libs libnl-1` NLVERSION = 1.0 OBJS = iw.o info.o phy.o interface.o station.o util.o mpath.o reg.o mesh.o genl.o @@ -42,7 +42,7 @@ version.h: version.sh iw: $(OBJS) @$(NQ) ' CC ' iw - $(Q)$(CC) $(LDFLAGS) $(OBJS) -o iw + $(Q)$(CC) $(LDFLAGS) $(OBJS) $(LIBS) -o iw check: $(Q)$(MAKE) all CC="REAL_CC=$(CC) CHECK=\"sparse -Wall\" cgcc"