OSDN Git Service

v24
[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.24
8 PROGS= iwconfig iwlist iwpriv iwspy iwgetid iwevent
9 MANPAGES=iwconfig.8 iwlist.8 iwpriv.8 iwspy.8 iwgetid.8 iwevent.8
10
11 # Composition of the library :
12 OBJS = iwlib.o
13
14 # Define if tools should be built using static or dynamic version of the lib
15 IWLIB=$(STATIC)
16 #IWLIB=$(DYNAMIC)
17
18 # Standard name for dynamic library so that the dynamic linker can pick it.
19 # We will just create a symbolic link to the real thing.
20 DYNAMIC_LINK= libiw.so
21
22 # Installation directory. By default, go in local.
23 # Distributions should probably use /usr/sbin, but they probably know better...
24 # Don't forget trailing slash to avoid issues
25
26 INSTALL_DIR= /usr/local/sbin/
27 INSTALL_LIB= /usr/local/lib/
28 INSTALL_INC= /usr/local/include/
29 INSTALL_MAN= /usr/local/man
30
31 # Header selection is now supposed to be automatic...
32
33 # Use private copy of Wireless Extension definition instead of the
34 # system wide one in /usr/include/linux. Use with care.
35 # Can be used to create multiple versions of the tools on the same system
36 # for multiple kernels or get around broken distributions.
37 #WE_HEADER= -DPRIVATE_WE_HEADER
38 WE_HEADER=
39
40 # ------------ End of config --------------
41
42 CC = gcc
43 RM = rm -f
44
45 RM_CMD = $(RM) *.BAK *.bak *.o *.so ,* *~ *.a *.orig *.rej
46
47 #CFLAGS=-O2 -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror
48 CFLAGS=-O2 -W -Wall -Wstrict-prototypes
49 XCFLAGS=$(CFLAGS) $(WARN) $(HEADERS) $(WE_HEADER)
50 PICFLAG=-fPIC
51
52 LIBS= -lm
53
54 all:: $(STATIC) $(DYNAMIC) $(PROGS)
55
56 %: %.o
57         $(CC) $(XCFLAGS) -o $@ $^ $(LIBS)
58 %.o: %.c
59         $(CC) $(XCFLAGS) -c $<
60 %.so: %.c
61         $(CC) $(XCFLAGS) $(PICFLAG) -c -o $@ $<
62
63 iwconfig: iwconfig.o $(IWLIB)
64
65 iwlist: iwlist.o $(IWLIB)
66
67 iwpriv: iwpriv.o $(IWLIB)
68
69 iwspy: iwspy.o $(IWLIB)
70
71 iwgetid: iwgetid.o
72
73 iwevent: iwevent.o $(IWLIB)
74
75 macaddr: macaddr.o $(IWLIB)
76
77 # Compilation of the dynamic library
78 $(DYNAMIC): $(OBJS:.o=.so)
79         $(CC) -shared -o $@ -Wl,-soname,$@ -lm -lc $^
80
81 # Compilation of the static library
82 $(STATIC): $(OBJS)
83         $(RM) $@
84         ar cru $@ $^
85         ranlib $@
86
87 # So crude but so effective ;-)
88 # Less crude thanks to many contributions ;-)
89 install::
90         install -m 755 $(PROGS) $(INSTALL_DIR)
91         install -m 644 $(STATIC) $(INSTALL_LIB)
92         install -m 755 $(DYNAMIC) $(INSTALL_LIB)
93         ln -s $(INSTALL_LIB)/$(DYNAMIC) $(INSTALL_LIB)/$(DYNAMIC_LINK)
94         echo "Don't forget to add $(INSTALL_LIB) to /etc/ld.so.conf, and run ldconfig."
95         install -m 644 iwlib.h $(INSTALL_INC)
96         install -m 644 $(MANPAGES) $(INSTALL_MAN)/man8/
97
98 clean::
99         $(RM_CMD) 
100
101 realclean::
102         $(RM_CMD) 
103         $(RM) $(STATIC) $(DYNAMIC) $(PROGS) macaddr
104
105 depend::
106         makedepend -s "# DO NOT DELETE" -- $(INCLUDES) -- $(SRCS)
107 # DO NOT DELETE