X-Git-Url: http://git.osdn.net/view?p=android-x86%2Fexternal-wireless-tools.git;a=blobdiff_plain;f=wireless_tools%2FMakefile;fp=wireless_tools%2FMakefile;h=7a7dec9d2c92a34c5e8f6018b7a31ea136184d93;hp=5de0c9ac67ae2016bedee4c149557d099e90ac9d;hb=1b80ed8726aa0f9de14e4231e8d199e5e27ef533;hpb=92c266503ddec9d3bd219978c118a77a46dc12d4 diff --git a/wireless_tools/Makefile b/wireless_tools/Makefile index 5de0c9a..7a7dec9 100644 --- a/wireless_tools/Makefile +++ b/wireless_tools/Makefile @@ -1,56 +1,88 @@ -# -# Basic and crude Makefile... -# +## +## Please check the configurion parameters below +## + +## Installation directory. By default, go in /usr/local +## Distributions should probably use /usr, but they probably know better... +PREFIX = /usr/local + +## Compiler to use +CC = gcc + +## Uncomment this to build against this kernel +# KERNEL_SRC = /usr/src/linux + +## Uncomment this to force a particular version of wireless extensions. +## This would use private copy of Wireless Extension definition instead +## of the system wide one in /usr/include/linux. Use with care. +## Can be used to create multiple versions of the tools on the same system +## for multiple kernels or get around broken distributions. +# FORCE_WEXT_VERSION = 14 + +## Uncomment this to build tools using dynamic version of the library +# BUILD_SHARED = y + +## Uncomment this to build without using libm (less efficient) +## This is mostly useful for embedded platforms +# BUILD_NOLIBM = y + +# *************************************************************************** +# ***** Most users should not need to change anything beyond this point ***** +# *************************************************************************** # Targets to build STATIC=libiw.a -DYNAMIC=libiw.so.24 +DYNAMIC=libiw.so.25 PROGS= iwconfig iwlist iwpriv iwspy iwgetid iwevent -MANPAGES=iwconfig.8 iwlist.8 iwpriv.8 iwspy.8 iwgetid.8 iwevent.8 +MANPAGES8=iwconfig.8 iwlist.8 iwpriv.8 iwspy.8 iwgetid.8 iwevent.8 +MANPAGES7=wireless.7 # Composition of the library : OBJS = iwlib.o -# Define if tools should be built using static or dynamic version of the lib -IWLIB=$(STATIC) -#IWLIB=$(DYNAMIC) +# Select library to link tool with +ifdef BUILD_SHARED + IWLIB=$(DYNAMIC) +else + IWLIB=$(STATIC) +endif # 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... -# Don't forget trailing slash to avoid issues +# Install directories +INSTALL_DIR= $(PREFIX)/sbin/ +INSTALL_LIB= $(PREFIX)/lib/ +INSTALL_INC= $(PREFIX)/include/ +INSTALL_MAN= $(PREFIX)/man/ -INSTALL_DIR= /usr/local/sbin/ -INSTALL_LIB= /usr/local/lib/ -INSTALL_INC= /usr/local/include/ -INSTALL_MAN= /usr/local/man +# Use local header if the version of wireless extensions is specified +ifdef FORCE_WEXT_VERSION + WEXT_FLAG = -DWEXT_HEADER=\"wireless.$(FORCE_WEXT_VERSION).h\" +endif -# 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. -# Can be used to create multiple versions of the tools on the same system -# for multiple kernels or get around broken distributions. -#WE_HEADER= -DPRIVATE_WE_HEADER -WE_HEADER= - -# ------------ End of config -------------- - -CC = gcc RM = rm -f RM_CMD = $(RM) *.BAK *.bak *.o *.so ,* *~ *.a *.orig *.rej +ifdef KERNEL_SRC + KERNEL_INCLUDES = -I $(KERNEL_SRC)/include +endif + +# Do we want to build with or without libm ? +ifdef BUILD_NOLIBM + LIBS= + WELIB_FLAG = -DWE_NOLIBM=y +else + LIBS= -lm +endif + #CFLAGS=-O2 -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror CFLAGS=-O2 -W -Wall -Wstrict-prototypes -XCFLAGS=$(CFLAGS) $(WARN) $(HEADERS) $(WE_HEADER) +XCFLAGS=$(CFLAGS) $(WARN) $(HEADERS) $(WEXT_FLAG) $(WELIB_FLAG) $(KERNEL_INCLUDES) PICFLAG=-fPIC -LIBS= -lm - all:: $(STATIC) $(DYNAMIC) $(PROGS) %: %.o @@ -87,13 +119,19 @@ $(STATIC): $(OBJS) # So crude but so effective ;-) # Less crude thanks to many contributions ;-) install:: + install -m 755 -d $(INSTALL_DIR) install -m 755 $(PROGS) $(INSTALL_DIR) + install -m 755 -d $(INSTALL_LIB) install -m 644 $(STATIC) $(INSTALL_LIB) install -m 755 $(DYNAMIC) $(INSTALL_LIB) - ln -s $(INSTALL_LIB)/$(DYNAMIC) $(INSTALL_LIB)/$(DYNAMIC_LINK) + ln -sfn $(DYNAMIC) $(INSTALL_LIB)/$(DYNAMIC_LINK) echo "Don't forget to add $(INSTALL_LIB) to /etc/ld.so.conf, and run ldconfig." + install -m 755 -d $(INSTALL_INC) install -m 644 iwlib.h $(INSTALL_INC) - install -m 644 $(MANPAGES) $(INSTALL_MAN)/man8/ + install -m 755 -d $(INSTALL_MAN)/man8/ + install -m 644 $(MANPAGES8) $(INSTALL_MAN)/man8/ + install -m 755 -d $(INSTALL_MAN)/man7/ + install -m 644 $(MANPAGES7) $(INSTALL_MAN)/man7/ clean:: $(RM_CMD) @@ -102,6 +140,20 @@ realclean:: $(RM_CMD) $(RM) $(STATIC) $(DYNAMIC) $(PROGS) macaddr +uninstall:: + for f in $(PROGS); do \ + $(RM) $(INSTALL_DIR)/$$f; \ + done + $(RM) $(INSTALL_LIB)/$(STATIC) + $(RM) $(INSTALL_LIB)/$(DYNAMIC) + $(RM) $(INSTALL_LIB)/$(DYNAMIC_LINK) + $(RM) $(INSTALL_INC)/iwlib.h + for f in $(MANPAGES8); do \ + $(RM) $(INSTALL_MAN)/man8/$$f; \ + for f in $(MANPAGES7); do \ + $(RM) $(INSTALL_MAN)/man7/$$f; \ + done + depend:: makedepend -s "# DO NOT DELETE" -- $(INCLUDES) -- $(SRCS) # DO NOT DELETE