| 1 | pass ldflags, read cflags, build shared, respect toolchain
|
| 2 | diff --git a/Makefile b/Makefile
|
| 3 | index 0078324..d722946 100644
|
| 4 | |
| 5 | |
| 6 | @@ -9,17 +9,17 @@ ifndef PREFIX
|
| 7 | endif
|
| 8 |
|
| 9 | ## Compiler to use (modify this for cross compile).
|
| 10 | -CC = gcc
|
| 11 | +CC ?= gcc
|
| 12 | ## Other tools you need to modify for cross compile (static lib only).
|
| 13 | -AR = ar
|
| 14 | -RANLIB = ranlib
|
| 15 | +AR ?= ar
|
| 16 | +RANLIB ?= ranlib
|
| 17 |
|
| 18 | ## Uncomment this to build tools using static version of the library.
|
| 19 | ## Mostly useful for embedded platforms without ldd, or to create
|
| 20 | ## a local version (non-root).
|
| 21 | ## Standard distros should comment that option to save space and to
|
| 22 | ## build libiw.so used by third parties...
|
| 23 | -BUILD_STATIC = y
|
| 24 | +#BUILD_STATIC = y
|
| 25 |
|
| 26 | ## Uncomment this to build without using libm (less efficient).
|
| 27 | ## This is mostly useful for embedded platforms without maths.
|
| 28 | @@ -104,7 +104,7 @@ ifdef BUILD_WE_ESSENTIAL
|
| 29 | endif
|
| 30 |
|
| 31 | # Other flags
|
| 32 | -CFLAGS=-Os -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow \
|
| 33 | +CFLAGS+=-W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow \
|
| 34 | -Wpointer-arith -Wcast-qual -Winline -I.
|
| 35 | #CFLAGS=-O2 -W -Wall -Wstrict-prototypes -I.
|
| 36 | DEPFLAGS=-MMD
|
| 37 | @@ -119,7 +119,7 @@ all:: $(IWLIB) $(PROGS)
|
| 38 | %.o: %.c wireless.h
|
| 39 | $(CC) $(XCFLAGS) -c $<
|
| 40 | %.so: %.c wireless.h
|
| 41 | - $(CC) $(XCFLAGS) $(PICFLAG) -c -o $@ $<
|
| 42 | + $(CC) $(XCFLAGS) $(PICFLAG) $(LDFLAGS) -c -o $@ $<
|
| 43 |
|
| 44 | iwconfig: iwconfig.o $(IWLIB)
|
| 45 |
|
| 46 | @@ -147,7 +147,7 @@ wireless.h:
|
| 47 |
|
| 48 | # Compilation of the dynamic library
|
| 49 | $(DYNAMIC): $(OBJS:.o=.so)
|
| 50 | - $(CC) -shared -o $@ -Wl,-soname,$@ $(STRIPFLAGS) $(LIBS) -lc $^
|
| 51 | + $(CC) -shared -o $@ -Wl,-soname,$@ $(STRIPFLAGS) $(LIBS) $(LDFLAGS) -lc $^
|
| 52 |
|
| 53 | # Compilation of the static library
|
| 54 | $(STATIC): $(OBJS:.o=.so)
|