blob: c27a5973e2d3f7017455eb79868083cd805953de [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001#############################################################
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
11LIB = libcares.a
12
13AR = $(CROSSPREFIX)ar
14CC = $(CROSSPREFIX)gcc
15LD = $(CROSSPREFIX)gcc
16RANLIB = $(CROSSPREFIX)ranlib
17#RM = rm -f
18CP = cp -afv
19
20CFLAGS = $(CARES_CFLAG_EXTRAS) -O2 -Wall -I.
21CFLAGS += -DCARES_STATICLIB
22LDFLAGS = $(CARES_LDFLAG_EXTRAS) -s
23LIBS = -lwsock32
24
25# Makefile.inc provides the CSOURCES and HHEADERS defines
26include Makefile.inc
27
28OBJLIB := $(patsubst %.c,%.o,$(strip $(CSOURCES)))
29
30
31$(LIB): $(OBJLIB)
32 $(AR) cru $@ $^
33 $(RANLIB) $@
34
35all: $(LIB) demos
36
37demos: adig.exe ahost.exe acountry.exe
38
39tags:
40 etags *.[ch]
41
42%.exe: %.o ares_getopt.o $(LIB)
43 $(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
44
45$(OBJLIB): ares.h ares_dns.h ares_private.h ares_build.h ares_rules.h
46
47.c.o:
48 $(CC) $(CFLAGS) -c $<
49
50ares_build.h:
51 $(CP) ares_build.h.dist ares_build.h
52
53check:
54
55install:
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}/ares.h ${DESTDIR}${includedir}
63 ${INSTALL} -m 444 ${srcdir}/ares_build.h ${DESTDIR}${includedir}
64 ${INSTALL} -m 444 ${srcdir}/ares_rules.h ${DESTDIR}${includedir}
65 (for man in $(MANPAGES); do \
66 ${INSTALL} -m 444 ${srcdir}/$${man} ${DESTDIR}${mandir}/man3; \
67 done)
68
69clean:
70 $(RM) ares_getopt.o $(OBJLIB) $(LIB) adig.exe ahost.exe acountry.exe
71
72distclean: clean
73 $(RM) config.cache config.log config.status Makefile
74ifeq "$(wildcard ares_build.h.dist)" "ares_build.h.dist"
75 $(RM) ares_build.h
76endif