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