Makefile.m32 2.1 KB

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