11cb0ef41Sopenharmony_ci#############################################################
21cb0ef41Sopenharmony_ci#
31cb0ef41Sopenharmony_ci# Makefile for building libcares.a with MingW32 (GCC-3.2)
41cb0ef41Sopenharmony_ci# Use: make -f Makefile.m32 [demos]
51cb0ef41Sopenharmony_ci#
61cb0ef41Sopenharmony_ci# Quick hack by Guenter; comments to: /dev/nul
71cb0ef41Sopenharmony_ci#
81cb0ef41Sopenharmony_ci# Copyright (C) The c-ares project and its contributors
91cb0ef41Sopenharmony_ci# SPDX-License-Identifier: MIT
101cb0ef41Sopenharmony_ci########################################################
111cb0ef41Sopenharmony_ci## Nothing more to do below this line!
121cb0ef41Sopenharmony_ci
131cb0ef41Sopenharmony_ciLIB	= src/lib/libcares.a
141cb0ef41Sopenharmony_ci
151cb0ef41Sopenharmony_ciAR	= $(CROSSPREFIX)ar
161cb0ef41Sopenharmony_ciCC	= $(CROSSPREFIX)gcc
171cb0ef41Sopenharmony_ciLD	= $(CROSSPREFIX)gcc
181cb0ef41Sopenharmony_ciRANLIB	= $(CROSSPREFIX)ranlib
191cb0ef41Sopenharmony_ci#RM	= rm -f
201cb0ef41Sopenharmony_ciCP	= cp -afv
211cb0ef41Sopenharmony_ci
221cb0ef41Sopenharmony_ciCFLAGS	= $(CARES_CFLAG_EXTRAS) -O2 -Wall -I./include -I./src/lib -D_WIN32_WINNT=0x0602
231cb0ef41Sopenharmony_ciCFLAGS	+= -DCARES_STATICLIB
241cb0ef41Sopenharmony_ciLDFLAGS	= $(CARES_LDFLAG_EXTRAS) -s
251cb0ef41Sopenharmony_ciLIBS	= -lws2_32 -liphlpapi
261cb0ef41Sopenharmony_ci
271cb0ef41Sopenharmony_ci# Makefile.inc provides the CSOURCES and HHEADERS defines
281cb0ef41Sopenharmony_ciinclude src/lib/Makefile.inc
291cb0ef41Sopenharmony_ci
301cb0ef41Sopenharmony_ciOBJLIB	:= $(patsubst %.c,src/lib/%.o,$(strip $(CSOURCES)))
311cb0ef41Sopenharmony_ci
321cb0ef41Sopenharmony_ci
331cb0ef41Sopenharmony_ci$(LIB): $(OBJLIB)
341cb0ef41Sopenharmony_ci	$(AR) cru $@ $^
351cb0ef41Sopenharmony_ci	$(RANLIB) $@
361cb0ef41Sopenharmony_ci
371cb0ef41Sopenharmony_ciall: $(LIB) demos
381cb0ef41Sopenharmony_ci
391cb0ef41Sopenharmony_cidemos: src/tools/adig.exe src/tools/ahost.exe
401cb0ef41Sopenharmony_ci
411cb0ef41Sopenharmony_citags:
421cb0ef41Sopenharmony_ci	etags *.[ch]
431cb0ef41Sopenharmony_ci
441cb0ef41Sopenharmony_ci%.exe: %.o src/tools/ares_getopt.o $(LIB)
451cb0ef41Sopenharmony_ci	$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
461cb0ef41Sopenharmony_ci
471cb0ef41Sopenharmony_ci$(OBJLIB): include/ares.h include/ares_dns.h include/ares_build.h
481cb0ef41Sopenharmony_ci
491cb0ef41Sopenharmony_ci.c.o:
501cb0ef41Sopenharmony_ci	$(CC) $(CFLAGS) -o $@ -c $<
511cb0ef41Sopenharmony_ci
521cb0ef41Sopenharmony_ciinclude/ares_build.h:
531cb0ef41Sopenharmony_ci	$(CP) include/ares_build.h.dist include/ares_build.h
541cb0ef41Sopenharmony_ci
551cb0ef41Sopenharmony_cicheck:
561cb0ef41Sopenharmony_ci
571cb0ef41Sopenharmony_ciinstall:
581cb0ef41Sopenharmony_ci	${top_srcdir}/mkinstalldirs ${DESTDIR}${libdir}
591cb0ef41Sopenharmony_ci	${top_srcdir}/mkinstalldirs ${DESTDIR}${includedir}
601cb0ef41Sopenharmony_ci	${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man3
611cb0ef41Sopenharmony_ci	${INSTALL} -m 644 $(LIB) ${DESTDIR}${libdir}
621cb0ef41Sopenharmony_ci	${RANLIB} ${DESTDIR}${libdir}/$(LIB)
631cb0ef41Sopenharmony_ci	chmod u-w ${DESTDIR}${libdir}/$(LIB)
641cb0ef41Sopenharmony_ci	${INSTALL} -m 444 ${srcdir}/include/ares.h ${DESTDIR}${includedir}
651cb0ef41Sopenharmony_ci	${INSTALL} -m 444 ${srcdir}/include/ares_build.h ${DESTDIR}${includedir}
661cb0ef41Sopenharmony_ci	${INSTALL} -m 444 ${srcdir}/include/ares_dns_record.h ${DESTDIR}${includedir}
671cb0ef41Sopenharmony_ci	${INSTALL} -m 444 ${srcdir}/include/ares_rules.h ${DESTDIR}${includedir}
681cb0ef41Sopenharmony_ci	${INSTALL} -m 444 ${srcdir}/include/ares_version.h ${DESTDIR}${includedir}
691cb0ef41Sopenharmony_ci	(for man in $(MANPAGES); do \
701cb0ef41Sopenharmony_ci	   ${INSTALL} -m 444 ${srcdir}/$${man} ${DESTDIR}${mandir}/man3; \
711cb0ef41Sopenharmony_ci	done)
721cb0ef41Sopenharmony_ci
731cb0ef41Sopenharmony_ciclean:
741cb0ef41Sopenharmony_ci	$(RM) src/tools/ares_getopt.o $(OBJLIB) $(LIB) src/tools/adig.exe src/tools/ahost.exe
751cb0ef41Sopenharmony_ci
761cb0ef41Sopenharmony_cidistclean: clean
771cb0ef41Sopenharmony_ci	$(RM) config.cache config.log config.status Makefile
781cb0ef41Sopenharmony_ciifeq "$(wildcard include/ares_build.h.dist)" "include/ares_build.h.dist"
791cb0ef41Sopenharmony_ci	$(RM) include/ares_build.h
801cb0ef41Sopenharmony_ciendif
81