lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 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 | ######################################################## |
| 9 | ## Nothing more to do below this line! |
| 10 | |
| 11 | LIB = libcares.a |
| 12 | |
| 13 | AR = $(CROSSPREFIX)ar |
| 14 | CC = $(CROSSPREFIX)gcc |
| 15 | LD = $(CROSSPREFIX)gcc |
| 16 | RANLIB = $(CROSSPREFIX)ranlib |
| 17 | #RM = rm -f |
| 18 | CP = cp -afv |
| 19 | |
| 20 | CFLAGS = $(CARES_CFLAG_EXTRAS) -O2 -Wall -I. |
| 21 | CFLAGS += -DCARES_STATICLIB |
| 22 | LDFLAGS = $(CARES_LDFLAG_EXTRAS) -s |
| 23 | LIBS = -lwsock32 |
| 24 | |
| 25 | # Makefile.inc provides the CSOURCES and HHEADERS defines |
| 26 | include Makefile.inc |
| 27 | |
| 28 | OBJLIB := $(patsubst %.c,%.o,$(strip $(CSOURCES))) |
| 29 | |
| 30 | |
| 31 | $(LIB): $(OBJLIB) |
| 32 | $(AR) cru $@ $^ |
| 33 | $(RANLIB) $@ |
| 34 | |
| 35 | all: $(LIB) demos |
| 36 | |
| 37 | demos: adig.exe ahost.exe acountry.exe |
| 38 | |
| 39 | tags: |
| 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 | |
| 50 | ares_build.h: |
| 51 | $(CP) ares_build.h.dist ares_build.h |
| 52 | |
| 53 | check: |
| 54 | |
| 55 | install: |
| 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 | |
| 69 | clean: |
| 70 | $(RM) ares_getopt.o $(OBJLIB) $(LIB) adig.exe ahost.exe acountry.exe |
| 71 | |
| 72 | distclean: clean |
| 73 | $(RM) config.cache config.log config.status Makefile |
| 74 | ifeq "$(wildcard ares_build.h.dist)" "ares_build.h.dist" |
| 75 | $(RM) ares_build.h |
| 76 | endif |