From a00e234001d9f14abb862ee2938b01d5fb0a616f Mon Sep 17 00:00:00 2001 From: Guenter Knauf Date: Tue, 3 Aug 2010 01:21:56 +0200 Subject: [PATCH] Added Watcom makefile based on libcurl's Makefile.Watcom. --- Makefile.Watcom | 160 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Makefile.am | 5 +- 2 files changed, 163 insertions(+), 2 deletions(-) create mode 100644 Makefile.Watcom diff --git a/Makefile.Watcom b/Makefile.Watcom new file mode 100644 index 0000000..bfbd3c6 --- /dev/null +++ b/Makefile.Watcom @@ -0,0 +1,160 @@ +# +# Watcom / OpenWatcom / Win32 makefile for cares. +# Quick hack by Guenter; comments to: /dev/nul +# + +!ifndef %watcom +!error WATCOM environment variable not set! +!else +SYS_INCL = -I$(%watcom)\h\nt -I$(%watcom)\h +SYS_LIBS = $(%watcom)\lib386\nt;$(%watcom)\lib386 +!endif + +TARGETS = cares_wc.dll cares_wc_imp.lib cares_wc.lib +DEMOS = adig.exe ahost.exe acountry.exe + +CC = wcc386 +LD = wlink +AR = wlib +RC = wrc + +!ifdef __LOADDLL__ +! loaddll wcc386 wccd386 +! loaddll wpp386 wppd386 +! loaddll wlib wlibd +!endif + +MD = mkdir +RM = del /q /f >NUL 2>&1 +RD = rmdir /q /s >NUL 2>&1 +CP = copy + +CFLAGS = -3r -mf -hc -zff -zgf -zq -zm -zc -s -fr=con -w2 -fpi -oilrtfm & + -wcd=201 -bt=nt -d+ -dWIN32 -dCARES_BUILDING_LIBRARY & + -dNTDDI_VERSION=0x05000100 -I. $(SYS_INCL) + +LFLAGS = option quiet, map, caseexact, eliminate + +!ifdef %debug +DEBUG = -dDEBUG=1 -dDEBUGBUILD +CFLAGS += -d3 $(DEBUG) +LFLAGS += debug all +!else +CFLAGS += -d0 +!endif + +!ifdef %use_ipv6 +CFLAGS += -d_WIN32_WINNT=0x0501 -dENABLE_IPV6 +!endif + +# +# Change to suite. +# +!ifdef %use_watt32 +CFLAGS += -dUSE_WATT32 -I$(%watt_root)\inc +!endif + +OBJ_BASE = WC_Win32.obj +LINK_ARG = $(OBJ_BASE)\dyn\wlink.arg +LIB_ARG = $(OBJ_BASE)\stat\wlib.arg + +# In order to process Makefile.inc wmake must be called with -u switch! +!ifneq __MAKEOPTS__ -u +!error You MUST call wmake with the -u switch! +!else +!include Makefile.inc +!endif + +OBJS = $(CSOURCES:.c=.obj) +OBJS = $OBJ_DIR\$(OBJS: = $OBJ_DIR\) + +# +# Use $(OBJS) as a template to generate $(OBJS_STAT) and $(OBJS_DYN). +# +OBJ_DIR = $(OBJ_BASE)\stat +OBJS_STAT = $+ $(OBJS) $- + +OBJ_DIR = $(OBJ_BASE)\dyn +OBJS_DYN = $+ $(OBJS) $- + +ARESBUILDH = ares_build.h +RESOURCE = $(OBJ_BASE)\dyn\cares.res + +all: $(ARESBUILDH) $(OBJ_BASE) $(TARGETS) .SYMBOLIC + @echo Welcome to cares + +demos: all $(DEMOS) .SYMBOLIC + @echo Welcome to cares-demos + +$(OBJ_BASE): + -$(MD) $^@ + -$(MD) $^@\stat + -$(MD) $^@\dyn + -$(MD) $^@\demos + +$(ARESBUILDH): .EXISTSONLY + $(CP) $^@.dist $^@ + +cares_wc.dll cares_wc_imp.lib: $(OBJS_DYN) $(RESOURCE) $(LINK_ARG) + $(LD) name cares_wc.dll @$(LINK_ARG) + +cares_wc.lib: $(OBJS_STAT) $(LIB_ARG) + $(AR) -q -b -c $^@ @$(LIB_ARG) + +adig.exe: $(OBJ_BASE)\demos\adig.obj $(OBJ_BASE)\demos\ares_getopt.obj cares_wc.lib + $(LD) name $^@ system nt $(LFLAGS) file { $[@ $(OBJ_BASE)\demos\ares_getopt.obj } library $]@, ws2_32.lib + +ahost.exe: $(OBJ_BASE)\demos\ahost.obj $(OBJ_BASE)\demos\ares_getopt.obj cares_wc.lib + $(LD) name $^@ system nt $(LFLAGS) file { $[@ $(OBJ_BASE)\demos\ares_getopt.obj } library $]@, ws2_32.lib + +acountry.exe: $(OBJ_BASE)\demos\acountry.obj $(OBJ_BASE)\demos\ares_getopt.obj cares_wc.lib + $(LD) name $^@ system nt $(LFLAGS) file { $[@ $(OBJ_BASE)\demos\ares_getopt.obj } library $]@, ws2_32.lib + +clean: .SYMBOLIC + -$(RM) $(OBJS_STAT) + -$(RM) $(OBJS_DYN) + -$(RM) $(RESOURCE) $(LINK_ARG) $(LIB_ARG) + +vclean realclean: clean .SYMBOLIC + -$(RM) $(TARGETS) cares_wc.map + -$(RM) $(DEMOS) $(DEMOS:.exe=.map) + -$(RD) $(OBJ_BASE)\stat + -$(RD) $(OBJ_BASE)\dyn + -$(RD) $(OBJ_BASE)\demos + -$(RD) $(OBJ_BASE) + +.ERASE +$(RESOURCE): cares.rc .AUTODEPEND + $(RC) $(DEBUG) -q -r -zm -I..\include $(SYS_INCL) $[@ -fo=$^@ + +.ERASE +.c{$(OBJ_BASE)\dyn}.obj: + $(CC) $(CFLAGS) -bd $[@ -fo=$^@ + +.ERASE +.c{$(OBJ_BASE)\stat}.obj: + $(CC) $(CFLAGS) -DCARES_STATICLIB $[@ -fo=$^@ + +.ERASE +.c{$(OBJ_BASE)\demos}.obj: + $(CC) $(CFLAGS) -DCARES_STATICLIB $[@ -fo=$^@ + +$(LINK_ARG): $(__MAKEFILES__) + %create $^@ + @%append $^@ system nt dll + @%append $^@ file { $(OBJS_DYN) } + @%append $^@ option res=$(RESOURCE), implib=cares_wc_imp.lib + @%append $^@ $(LFLAGS) + @%append $^@ libpath $(SYS_LIBS) +# @%append $^@ library clib3r.lib +!ifdef %use_watt32 + @%append $^@ library $(%watt_root)\lib\wattcpw_imp.lib +!else + @%append $^@ library ws2_32.lib +!endif + +$(LIB_ARG): $(__MAKEFILES__) + %create $^@ + @for %f in ($(OBJS_STAT)) do @%append $^@ +- %f + + diff --git a/Makefile.am b/Makefile.am index 672120d..31fbc38 100644 --- a/Makefile.am +++ b/Makefile.am @@ -52,9 +52,10 @@ noinst_PROGRAMS =$(PROGS) # adig and ahost are just sample programs and thus not mentioned with the # regular sources and headers EXTRA_DIST = AUTHORS CHANGES README.cares Makefile.inc Makefile.dj \ - Makefile.m32 Makefile.netware Makefile.msvc $(man_MANS) $(MSVCFILES) \ + Makefile.m32 Makefile.netware Makefile.msvc Makefile.Watcom $(man_MANS) \ config-win32.h RELEASE-NOTES libcares.pc.in buildconf get_ver.awk maketgz \ - TODO ares_build.h.in $(PDFPAGES) cares.rc README.msvc $(CSOURCES) $(HHEADERS) + TODO ares_build.h.in $(PDFPAGES) cares.rc README.msvc $(MSVCFILES) \ + $(CSOURCES) $(HHEADERS) CLEANFILES = $(PDFPAGES) $(HTMLPAGES) -- 2.7.4