Imported Upstream version 1.18.1
[platform/upstream/c-ares.git] / Makefile.m32
1 #############################################################
2 #
3 ## Makefile for building libcares.a with MingW32 (GCC-3.2)
4 ## Use: make -f Makefile.m32 [demos]
5 ##
6 ## Quick hack by Guenter; comments to: /dev/nul
7 #
8 ########################################################
9 ## Nothing more to do below this line!
10
11 LIB     = src/lib/libcares.a
12
13 AR      = $(CROSSPREFIX)ar
14 CC      = $(CROSSPREFIX)gcc
15 LD      = $(CROSSPREFIX)gcc
16 RANLIB  = $(CROSSPREFIX)ranlib
17 #RM     = rm -f
18 CP      = cp -afv
19
20 CFLAGS  = $(CARES_CFLAG_EXTRAS) -O2 -Wall -I./include -I./src/lib -D_WIN32_WINNT=0x0600
21 CFLAGS  += -DCARES_STATICLIB
22 LDFLAGS = $(CARES_LDFLAG_EXTRAS) -s
23 LIBS    = -lws2_32 -liphlpapi
24
25 # Makefile.inc provides the CSOURCES and HHEADERS defines
26 include src/lib/Makefile.inc
27
28 OBJLIB  := $(patsubst %.c,src/lib/%.o,$(strip $(CSOURCES)))
29
30
31 $(LIB): $(OBJLIB)
32         $(AR) cru $@ $^
33         $(RANLIB) $@
34
35 all: $(LIB) demos
36
37 demos: src/tools/adig.exe src/tools/ahost.exe src/tools/acountry.exe
38
39 tags:
40         etags *.[ch]
41
42 %.exe: %.o src/tools/ares_getopt.o $(LIB)
43         $(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
44
45 $(OBJLIB): include/ares.h include/ares_dns.h include/ares_build.h
46
47 .c.o:
48         $(CC) $(CFLAGS) -o $@ -c $<
49
50 include/ares_build.h:
51         $(CP) include/ares_build.h.dist include/ares_build.h
52
53 check:
54
55 install:
56         ${top_srcdir}/mkinstalldirs ${DESTDIR}${libdir}
57         ${top_srcdir}/mkinstalldirs ${DESTDIR}${includedir}
58         ${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man3
59         ${INSTALL} -m 644 $(LIB) ${DESTDIR}${libdir}
60         ${RANLIB} ${DESTDIR}${libdir}/$(LIB)
61         chmod u-w ${DESTDIR}${libdir}/$(LIB)
62         ${INSTALL} -m 444 ${srcdir}/include/ares.h ${DESTDIR}${includedir}
63         ${INSTALL} -m 444 ${srcdir}/include/ares_build.h ${DESTDIR}${includedir}
64         ${INSTALL} -m 444 ${srcdir}/include/ares_rules.h ${DESTDIR}${includedir}
65         ${INSTALL} -m 444 ${srcdir}/include/ares_version.h ${DESTDIR}${includedir}
66         (for man in $(MANPAGES); do \
67            ${INSTALL} -m 444 ${srcdir}/$${man} ${DESTDIR}${mandir}/man3; \
68         done)
69
70 clean:
71         $(RM) src/tools/ares_getopt.o $(OBJLIB) $(LIB) src/tools/adig.exe src/tools/ahost.exe src/tools/acountry.exe
72
73 distclean: clean
74         $(RM) config.cache config.log config.status Makefile
75 ifeq "$(wildcard include/ares_build.h.dist)" "include/ares_build.h.dist"
76         $(RM) include/ares_build.h
77 endif