OSDN Git Service

v22
[android-x86/external-wireless-tools.git] / wireless_tools / Makefile
1 #
2 # Basic and crude Makefile...
3 #
4
5 # Targets to build
6 STATIC=libiw.a
7 DYNAMIC=libiw.so.22
8 PROGS= iwconfig iwlist iwpriv iwspy iwgetid
9
10 # Composition of the library :
11 OBJS = iwlib.o
12
13 # Define if tools should be built using static or dynamic version of the lib
14 IWLIBS=$(OBJS)
15 #IWLIBS=-liw
16
17 # Installation directory. By default, go in local.
18 # Distributions should probably use /usr/sbin, but they probably know better...
19 INSTALL_DIR= /usr/local/sbin
20 INSTALL_LIB= /usr/local/lib
21 INSTALL_INC= /usr/local/include
22
23 # This is our header selection. Try to hide the mess and the misery :-(
24 # Please choose *only one* of the define...
25
26 # Kernel headers 2.4.X + Glibc 2.2 - Mandrake 8.0, Debian 2.3, RH 7.1
27 #HEADERS= -DGLIBC22_HEADERS
28
29 # Kernel headers 2.0.X + Glibc 2.0 - Debian 2.0, RH 5
30 # Kernel headers 2.2.X + Glibc 2.1 - Debian 2.2, RH 6.1
31 # Kernel headers 2.4.X + Glibc 2.1 - Debian 2.2 upgraded, RH 7.0
32 HEADERS= -DGLIBC_HEADERS
33
34 # Kernel headers 2.2.X + Glibc 2.0 - Debian 2.1
35 #HEADERS= -DKLUDGE_HEADERS
36
37 # Kernel headers 2.0.X + libc5 - old systems
38 #HEADERS= -DLIBC5_HEADERS
39
40 # Use private copy of Wireless Extension definition instead of the
41 # system wide one in /usr/include/linux. Use with care.
42 # Can be used to create multiple versions of the tools on the same system
43 # for multiple kernels or get around broken distributions.
44 #WE_HEADER= -DPRIVATE_WE_HEADER
45 WE_HEADER=
46
47 # ------------ End of config --------------
48
49 CC = gcc
50 RM = rm -f
51
52 RM_CMD = $(RM) *.BAK *.bak *.o ,* *~ *.a
53
54 CFLAGS=-O2 -Wall $(HEADERS) $(WE_HEADER)
55
56 LIBS=$(IWLIBS) -lm
57
58 all:: $(STATIC) $(DYNAMIC) $(PROGS)
59
60 .c.o:
61         $(CC) $(CFLAGS) -c $<
62
63 iwconfig: iwconfig.o $(OBJS)
64         $(CC) $(CFLAGS) -o $@ $< $(LIBS)
65
66 iwlist: iwlist.o $(OBJS)
67         $(CC) $(CFLAGS) -o $@ $< $(LIBS)
68
69 iwpriv: iwpriv.o $(OBJS)
70         $(CC) $(CFLAGS) -o $@ $< $(LIBS)
71
72 iwspy: iwspy.o $(OBJS)
73         $(CC) $(CFLAGS) -o $@ $< $(LIBS)
74
75 iwgetid: iwgetid.o
76         $(CC) $(CFLAGS) -o $@ $^
77
78 # Compilation of the dynamic library
79 libiw.so.22: $(OBJS)
80         $(CC) -O2 -shared -o $@ -Wl,-soname,$@ -lm -lc $^
81
82 # Compilation of the static library
83 libiw.a: $(OBJS)
84         $(RM) $@
85         ar cru $@ $^
86         ranlib $@
87
88 # So crude but so effective ;-)
89 install::
90         cp $(PROGS) $(INSTALL_DIR)
91         cp $(STATIC) $(DYNAMIC) $(INSTALL_LIB)
92         echo "Don't forget to fix you /etc/ld.so.conf and run ldconfig."
93         cp iwlib.h $(INSTALL_INC)
94
95 clean::
96         $(RM_CMD) 
97
98 realclean::
99         $(RM_CMD) 
100         $(RM) $(STATIC) $(DYNAMIC) $(PROGS)
101
102 depend::
103         makedepend -s "# DO NOT DELETE" -- $(INCLUDES) -- $(SRCS)
104 # DO NOT DELETE