#############################################################
-# $Id$
#
## Makefile for building libcares.a with MingW32 (GCC-3.2)
## Use: make -f Makefile.m32 [demos]
##
## Quick hack by Guenter; comments to: /dev/nul
-
-CC = gcc
-RANLIB = ranlib
-
+#
########################################################
## Nothing more to do below this line!
-LIB=libcares.a
-CC=gcc
-CFLAGS=-O2 -Wall
-LDFLAGS=-s
-LIBS=-lwsock32
+LIB = libcares.a
+
+AR = ar
+CC = gcc
+LD = gcc
+RANLIB = ranlib
+#RM = rm -f
-MANPAGES := $(patsubst %.c,%.o,$(wildcard ares_*.3))
+CFLAGS = -O2 -Wall -I.
+LDFLAGS = -s
+LIBS = -lwsock32
-OBJS := $(patsubst %.c,%.o,$(wildcard ares_*.c))
-OBJS += windows_port.o inet_ntop.o inet_net_pton.o bitncmp.o
+# Makefile.inc provides the CSOURCES and HHEADERS defines
+include Makefile.inc
-$(LIB): ${OBJS}
- ar cru $@ ${OBJS}
- ${RANLIB} $@
+OBJLIB := $(patsubst %.c,%.o,$(strip $(CSOURCES)))
+
+
+$(LIB): $(OBJLIB)
+ $(AR) cru $@ $^
+ $(RANLIB) $@
all: $(LIB) demos
-demos: adig.exe ahost.exe
+demos: adig.exe ahost.exe acountry.exe
tags:
etags *.[ch]
-adig.exe: adig.o $(LIB)
- ${CC} ${LDFLAGS} -o $@ adig.o $(LIB) ${LIBS}
-
-ahost.exe: ahost.o $(LIB)
- ${CC} ${LDFLAGS} -o $@ ahost.o $(LIB) ${LIBS}
+%.exe: %.o ares_getopt.o $(LIB)
+ $(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
-${OBJS}: ares.h ares_dns.h ares_private.h
+$(OBJLIB): ares.h ares_dns.h ares_private.h ares_build.h ares_rules.h
.c.o:
- ${CC} -c ${CFLAGS} $<
+ $(CC) $(CFLAGS) -c $<
check:
${RANLIB} ${DESTDIR}${libdir}/$(LIB)
chmod u-w ${DESTDIR}${libdir}/$(LIB)
${INSTALL} -m 444 ${srcdir}/ares.h ${DESTDIR}${includedir}
- ${INSTALL} -m 444 ${srcdir}/ares_version.h ${DESTDIR}${includedir}
+ ${INSTALL} -m 444 ${srcdir}/ares_build.h ${DESTDIR}${includedir}
+ ${INSTALL} -m 444 ${srcdir}/ares_rules.h ${DESTDIR}${includedir}
(for man in $(MANPAGES); do \
${INSTALL} -m 444 ${srcdir}/$${man} ${DESTDIR}${mandir}/man3; \
done)
clean:
- rm -f ${OBJS} $(LIB) adig.o adig.exe ahost.o ahost.exe
+ $(RM) ares_getopt.o $(OBJLIB) $(LIB) adig.exe ahost.exe acountry.exe
distclean: clean
- rm -f config.cache config.log config.status Makefile
+ $(RM) config.cache config.log config.status Makefile