• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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# Copyright (C) The c-ares project and its contributors
9# SPDX-License-Identifier: MIT
10########################################################
11## Nothing more to do below this line!
12
13LIB	= src/lib/libcares.a
14
15AR	= $(CROSSPREFIX)ar
16CC	= $(CROSSPREFIX)gcc
17LD	= $(CROSSPREFIX)gcc
18RANLIB	= $(CROSSPREFIX)ranlib
19#RM	= rm -f
20CP	= cp -afv
21
22CFLAGS	= $(CARES_CFLAG_EXTRAS) -O2 -Wall -I./include -I./src/lib -D_WIN32_WINNT=0x0602
23CFLAGS	+= -DCARES_STATICLIB
24LDFLAGS	= $(CARES_LDFLAG_EXTRAS) -s
25LIBS	= -lws2_32 -liphlpapi
26
27# Makefile.inc provides the CSOURCES and HHEADERS defines
28include src/lib/Makefile.inc
29
30OBJLIB	:= $(patsubst %.c,src/lib/%.o,$(strip $(CSOURCES)))
31
32
33$(LIB): $(OBJLIB)
34	$(AR) cru $@ $^
35	$(RANLIB) $@
36
37all: $(LIB) demos
38
39demos: src/tools/adig.exe src/tools/ahost.exe
40
41tags:
42	etags *.[ch]
43
44%.exe: %.o src/tools/ares_getopt.o $(LIB)
45	$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
46
47$(OBJLIB): include/ares.h include/ares_dns.h include/ares_build.h
48
49.c.o:
50	$(CC) $(CFLAGS) -o $@ -c $<
51
52include/ares_build.h:
53	$(CP) include/ares_build.h.dist include/ares_build.h
54
55check:
56
57install:
58	${top_srcdir}/mkinstalldirs ${DESTDIR}${libdir}
59	${top_srcdir}/mkinstalldirs ${DESTDIR}${includedir}
60	${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man3
61	${INSTALL} -m 644 $(LIB) ${DESTDIR}${libdir}
62	${RANLIB} ${DESTDIR}${libdir}/$(LIB)
63	chmod u-w ${DESTDIR}${libdir}/$(LIB)
64	${INSTALL} -m 444 ${srcdir}/include/ares.h ${DESTDIR}${includedir}
65	${INSTALL} -m 444 ${srcdir}/include/ares_build.h ${DESTDIR}${includedir}
66	${INSTALL} -m 444 ${srcdir}/include/ares_dns_record.h ${DESTDIR}${includedir}
67	${INSTALL} -m 444 ${srcdir}/include/ares_rules.h ${DESTDIR}${includedir}
68	${INSTALL} -m 444 ${srcdir}/include/ares_version.h ${DESTDIR}${includedir}
69	(for man in $(MANPAGES); do \
70	   ${INSTALL} -m 444 ${srcdir}/$${man} ${DESTDIR}${mandir}/man3; \
71	done)
72
73clean:
74	$(RM) src/tools/ares_getopt.o $(OBJLIB) $(LIB) src/tools/adig.exe src/tools/ahost.exe
75
76distclean: clean
77	$(RM) config.cache config.log config.status Makefile
78ifeq "$(wildcard include/ares_build.h.dist)" "include/ares_build.h.dist"
79	$(RM) include/ares_build.h
80endif
81