added MingW32 makefile.
[platform/upstream/c-ares.git] / Makefile.m32
1 #############################################################
2 # $Id$
3 #
4 ## Makefile for building libcares.a with MingW32 (GCC-3.2)
5 ## Use: make -f Makefile.m32 [demos]
6 ##
7 ## Quick hack by Guenter; comments to: /dev/nul
8
9 CC = gcc
10 AR = ar
11 RANLIB = ranlib
12 STRIP = strip -g
13 #RM = rm -f 
14
15 ########################################################
16 ## Nothing more to do below this line!
17
18 LIB=libcares.a
19 CC=gcc
20 #CPPFLAGS=@CPPFLAGS@
21 WARN_FLAGS=-Wall
22 CFLAGS=-O2 -DMINGW32
23 CFLAGS+=${WARN_CFLAGS} ${ERROR_CFLAGS}
24 #DEFS=-DWIN32
25 LDFLAGS=-s
26 LIBS=-lwsock32
27 ALL_CFLAGS=${CPPFLAGS} ${CFLAGS} ${DEFS}
28
29 MANPAGES := $(patsubst %.c,%.o,$(wildcard ares_*.3))
30
31 OBJS    := $(patsubst %.c,%.o,$(wildcard ares_*.c))
32 OBJS    += windows_port.o
33
34 $(LIB): ${OBJS}
35         ar cru $@ ${OBJS}
36         ${RANLIB} $@
37
38 all: $(LIB) demos
39
40 demos: adig.exe ahost.exe
41
42 tags:
43         etags *.[ch]
44
45 adig.exe: adig.o $(LIB)
46         ${CC} ${LDFLAGS} -o $@ adig.o $(LIB) ${LIBS}
47
48 ahost.exe: ahost.o $(LIB)
49         ${CC} ${LDFLAGS} -o $@ ahost.o $(LIB) ${LIBS}
50
51 ${OBJS}: ares.h ares_dns.h ares_private.h
52
53 .c.o:
54         ${CC} -c ${ALL_CFLAGS} $<
55
56 check:
57
58 install:
59         ${top_srcdir}/mkinstalldirs ${DESTDIR}${libdir}
60         ${top_srcdir}/mkinstalldirs ${DESTDIR}${includedir}
61         ${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man3
62         ${INSTALL} -m 644 $(LIB) ${DESTDIR}${libdir}
63         ${RANLIB} ${DESTDIR}${libdir}/$(LIB)
64         chmod u-w ${DESTDIR}${libdir}/$(LIB)
65         ${INSTALL} -m 444 ${srcdir}/ares.h ${DESTDIR}${includedir}
66         ${INSTALL} -m 444 ${srcdir}/ares_version.h ${DESTDIR}${includedir}
67         (for man in $(MANPAGES); do \
68            ${INSTALL} -m 444 ${srcdir}/$${man} ${DESTDIR}${mandir}/man3; \
69         done)
70
71 clean:
72         rm -f ${OBJS} $(LIB) adig.o adig.exe ahost.o ahost.exe
73
74 distclean: clean
75         rm -f config.cache config.log config.status Makefile