summaryrefslogtreecommitdiff
path: root/Makefile.m32
blob: 42149f55e9523d794d9c5fd30952a545f1be0891 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#############################################################
#
## Makefile for building libcares.a with MingW32 (GCC-3.2)
## Use: make -f Makefile.m32 [demos]
##
## Quick hack by Guenter; comments to: /dev/nul
#
########################################################
## Nothing more to do below this line!

LIB	= libcares.a

AR	= ar
CC	= gcc
LD	= gcc
RANLIB	= ranlib
#RM	= rm -f
CP	= cp -afv

CFLAGS	= -O2 -Wall -I.
CFLAGS	+= -DCARES_STATICLIB
LDFLAGS	= -s
LIBS	= -lwsock32

# Makefile.inc provides the CSOURCES and HHEADERS defines
include Makefile.inc

OBJLIB	:= $(patsubst %.c,%.o,$(strip $(CSOURCES)))


$(LIB): $(OBJLIB)
	$(AR) cru $@ $^
	$(RANLIB) $@

all: $(LIB) demos

demos: adig.exe ahost.exe acountry.exe

tags:
	etags *.[ch]

%.exe: %.o ares_getopt.o $(LIB)
	$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)

$(OBJLIB): ares.h ares_dns.h ares_private.h ares_build.h ares_rules.h

.c.o:
	$(CC) $(CFLAGS) -c $<

ares_build.h:
	$(CP) ares_build.h.dist ares_build.h

check:

install:
	${top_srcdir}/mkinstalldirs ${DESTDIR}${libdir}
	${top_srcdir}/mkinstalldirs ${DESTDIR}${includedir}
	${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man3
	${INSTALL} -m 644 $(LIB) ${DESTDIR}${libdir}
	${RANLIB} ${DESTDIR}${libdir}/$(LIB)
	chmod u-w ${DESTDIR}${libdir}/$(LIB)
	${INSTALL} -m 444 ${srcdir}/ares.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) ares_getopt.o $(OBJLIB) $(LIB) adig.exe ahost.exe acountry.exe

distclean: clean
	$(RM) config.cache config.log config.status Makefile
ifeq "$(wildcard ares_build.h.dist)" "ares_build.h.dist"
	$(RM) ares_build.h
endif