pass ldflags, read cflags, build shared, respect toolchain diff --git a/Makefile b/Makefile index 0078324..d722946 100644 --- a/Makefile +++ b/Makefile @@ -9,17 +9,17 @@ ifndef PREFIX endif ## Compiler to use (modify this for cross compile). -CC = gcc +CC ?= gcc ## Other tools you need to modify for cross compile (static lib only). -AR = ar -RANLIB = ranlib +AR ?= ar +RANLIB ?= ranlib ## Uncomment this to build tools using static version of the library. ## Mostly useful for embedded platforms without ldd, or to create ## a local version (non-root). ## Standard distros should comment that option to save space and to ## build libiw.so used by third parties... -BUILD_STATIC = y +#BUILD_STATIC = y ## Uncomment this to build without using libm (less efficient). ## This is mostly useful for embedded platforms without maths. @@ -104,7 +104,7 @@ ifdef BUILD_WE_ESSENTIAL endif # Other flags -CFLAGS=-Os -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow \ +CFLAGS+=-W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow \ -Wpointer-arith -Wcast-qual -Winline -I. #CFLAGS=-O2 -W -Wall -Wstrict-prototypes -I. DEPFLAGS=-MMD @@ -119,7 +119,7 @@ all:: $(IWLIB) $(PROGS) %.o: %.c wireless.h $(CC) $(XCFLAGS) -c $< %.so: %.c wireless.h - $(CC) $(XCFLAGS) $(PICFLAG) -c -o $@ $< + $(CC) $(XCFLAGS) $(PICFLAG) $(LDFLAGS) -c -o $@ $< iwconfig: iwconfig.o $(IWLIB) @@ -147,7 +147,7 @@ wireless.h: # Compilation of the dynamic library $(DYNAMIC): $(OBJS:.o=.so) - $(CC) -shared -o $@ -Wl,-soname,$@ $(STRIPFLAGS) $(LIBS) -lc $^ + $(CC) -shared -o $@ -Wl,-soname,$@ $(STRIPFLAGS) $(LIBS) $(LDFLAGS) -lc $^ # Compilation of the static library $(STATIC): $(OBJS:.o=.so)