X-Git-Url: http://git.osdn.net/view?p=android-x86%2Fexternal-wireless-tools.git;a=blobdiff_plain;f=wireless_tools%2FMakefile;h=5de0c9ac67ae2016bedee4c149557d099e90ac9d;hp=236acbbf6ed52564cbd5dd6c35a5e91697f93a5d;hb=92c266503ddec9d3bd219978c118a77a46dc12d4;hpb=fb1188c580d9ff90cc4d80d2bedb03e86b463057 diff --git a/wireless_tools/Makefile b/wireless_tools/Makefile index 236acbb..5de0c9a 100644 --- a/wireless_tools/Makefile +++ b/wireless_tools/Makefile @@ -4,38 +4,31 @@ # Targets to build STATIC=libiw.a -DYNAMIC=libiw.so.22 -PROGS= iwconfig iwlist iwpriv iwspy iwgetid +DYNAMIC=libiw.so.24 +PROGS= iwconfig iwlist iwpriv iwspy iwgetid iwevent +MANPAGES=iwconfig.8 iwlist.8 iwpriv.8 iwspy.8 iwgetid.8 iwevent.8 # Composition of the library : OBJS = iwlib.o # Define if tools should be built using static or dynamic version of the lib -IWLIBS=$(OBJS) -#IWLIBS=-liw +IWLIB=$(STATIC) +#IWLIB=$(DYNAMIC) + +# Standard name for dynamic library so that the dynamic linker can pick it. +# We will just create a symbolic link to the real thing. +DYNAMIC_LINK= libiw.so # Installation directory. By default, go in local. # Distributions should probably use /usr/sbin, but they probably know better... -INSTALL_DIR= /usr/local/sbin -INSTALL_LIB= /usr/local/lib -INSTALL_INC= /usr/local/include - -# This is our header selection. Try to hide the mess and the misery :-( -# Please choose *only one* of the define... - -# Kernel headers 2.4.X + Glibc 2.2 - Mandrake 8.0, Debian 2.3, RH 7.1 -#HEADERS= -DGLIBC22_HEADERS +# Don't forget trailing slash to avoid issues -# Kernel headers 2.0.X + Glibc 2.0 - Debian 2.0, RH 5 -# Kernel headers 2.2.X + Glibc 2.1 - Debian 2.2, RH 6.1 -# Kernel headers 2.4.X + Glibc 2.1 - Debian 2.2 upgraded, RH 7.0 -HEADERS= -DGLIBC_HEADERS +INSTALL_DIR= /usr/local/sbin/ +INSTALL_LIB= /usr/local/lib/ +INSTALL_INC= /usr/local/include/ +INSTALL_MAN= /usr/local/man -# Kernel headers 2.2.X + Glibc 2.0 - Debian 2.1 -#HEADERS= -DKLUDGE_HEADERS - -# Kernel headers 2.0.X + libc5 - old systems -#HEADERS= -DLIBC5_HEADERS +# Header selection is now supposed to be automatic... # Use private copy of Wireless Extension definition instead of the # system wide one in /usr/include/linux. Use with care. @@ -49,55 +42,65 @@ WE_HEADER= CC = gcc RM = rm -f -RM_CMD = $(RM) *.BAK *.bak *.o ,* *~ *.a +RM_CMD = $(RM) *.BAK *.bak *.o *.so ,* *~ *.a *.orig *.rej -CFLAGS=-O2 -Wall $(HEADERS) $(WE_HEADER) +#CFLAGS=-O2 -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror +CFLAGS=-O2 -W -Wall -Wstrict-prototypes +XCFLAGS=$(CFLAGS) $(WARN) $(HEADERS) $(WE_HEADER) +PICFLAG=-fPIC -LIBS=$(IWLIBS) -lm +LIBS= -lm all:: $(STATIC) $(DYNAMIC) $(PROGS) -.c.o: - $(CC) $(CFLAGS) -c $< +%: %.o + $(CC) $(XCFLAGS) -o $@ $^ $(LIBS) +%.o: %.c + $(CC) $(XCFLAGS) -c $< +%.so: %.c + $(CC) $(XCFLAGS) $(PICFLAG) -c -o $@ $< -iwconfig: iwconfig.o $(OBJS) - $(CC) $(CFLAGS) -o $@ $< $(LIBS) +iwconfig: iwconfig.o $(IWLIB) -iwlist: iwlist.o $(OBJS) - $(CC) $(CFLAGS) -o $@ $< $(LIBS) +iwlist: iwlist.o $(IWLIB) -iwpriv: iwpriv.o $(OBJS) - $(CC) $(CFLAGS) -o $@ $< $(LIBS) +iwpriv: iwpriv.o $(IWLIB) -iwspy: iwspy.o $(OBJS) - $(CC) $(CFLAGS) -o $@ $< $(LIBS) +iwspy: iwspy.o $(IWLIB) iwgetid: iwgetid.o - $(CC) $(CFLAGS) -o $@ $^ + +iwevent: iwevent.o $(IWLIB) + +macaddr: macaddr.o $(IWLIB) # Compilation of the dynamic library -libiw.so.22: $(OBJS) - $(CC) -O2 -shared -o $@ -Wl,-soname,$@ -lm -lc $^ +$(DYNAMIC): $(OBJS:.o=.so) + $(CC) -shared -o $@ -Wl,-soname,$@ -lm -lc $^ # Compilation of the static library -libiw.a: $(OBJS) +$(STATIC): $(OBJS) $(RM) $@ ar cru $@ $^ ranlib $@ # So crude but so effective ;-) +# Less crude thanks to many contributions ;-) install:: - cp $(PROGS) $(INSTALL_DIR) - cp $(STATIC) $(DYNAMIC) $(INSTALL_LIB) - echo "Don't forget to fix you /etc/ld.so.conf and run ldconfig." - cp iwlib.h $(INSTALL_INC) + install -m 755 $(PROGS) $(INSTALL_DIR) + install -m 644 $(STATIC) $(INSTALL_LIB) + install -m 755 $(DYNAMIC) $(INSTALL_LIB) + ln -s $(INSTALL_LIB)/$(DYNAMIC) $(INSTALL_LIB)/$(DYNAMIC_LINK) + echo "Don't forget to add $(INSTALL_LIB) to /etc/ld.so.conf, and run ldconfig." + install -m 644 iwlib.h $(INSTALL_INC) + install -m 644 $(MANPAGES) $(INSTALL_MAN)/man8/ clean:: $(RM_CMD) realclean:: $(RM_CMD) - $(RM) $(STATIC) $(DYNAMIC) $(PROGS) + $(RM) $(STATIC) $(DYNAMIC) $(PROGS) macaddr depend:: makedepend -s "# DO NOT DELETE" -- $(INCLUDES) -- $(SRCS)