• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#
2#  Watcom / OpenWatcom / Win32 makefile for cares.
3#  Quick hack by Guenter; comments to: /dev/nul
4#
5
6!ifndef %watcom
7!error WATCOM environment variable not set!
8!else
9SYS_INCL = -I$(%watcom)\h\nt -I$(%watcom)\h
10SYS_LIBS = $(%watcom)\lib386\nt;$(%watcom)\lib386
11!endif
12
13!ifdef %libname
14LIBNAME = $(%libname)
15!else
16LIBNAME	= cares
17!endif
18TARGETS = $(LIBNAME).dll $(LIBNAME)_imp.lib $(LIBNAME).lib
19DEMOS   = adig.exe ahost.exe acountry.exe
20
21CC = wcc386
22LD = wlink
23AR = wlib
24RC = wrc
25
26!ifdef __LOADDLL__
27!  loaddll wcc386  wccd386
28!  loaddll wpp386  wppd386
29!  loaddll wlib    wlibd
30!endif
31
32!if $(__VERSION__) < 1250
33RM = del /q /f 2>NUL
34!else
35RM = rm -f
36!endif
37MD = mkdir
38RD = rmdir /q /s 2>NUL
39CP = copy
40
41CFLAGS = -3r -mf -hc -zff -zgf -zq -zm -zc -s -fr=con -w2 -fpi -oilrtfm &
42         -wcd=201 -bt=nt -d+ -dWIN32 -dCARES_BUILDING_LIBRARY           &
43         -dNTDDI_VERSION=0x05010000 -I. $(SYS_INCL)
44
45LFLAGS = option quiet, map, caseexact, eliminate
46
47!ifdef %debug
48DEBUG  = -dDEBUG=1 -dDEBUGBUILD
49CFLAGS += -d3 $(DEBUG)
50LFLAGS += debug all
51!else
52CFLAGS += -d0
53!endif
54
55CFLAGS += -d_WIN32_WINNT=0x0600
56
57#
58# Change to suite.
59#
60!ifdef %use_watt32
61CFLAGS += -dWATT32 -I$(%watt_root)\inc
62!endif
63
64OBJ_BASE = WC_Win32.obj
65LINK_ARG = $(OBJ_BASE)\dyn\wlink.arg
66LIB_ARG  = $(OBJ_BASE)\stat\wlib.arg
67
68# In order to process Makefile.inc wmake must be called with -u switch!
69!ifneq __MAKEOPTS__ -u
70!error You MUST call wmake with the -u switch!
71!else
72!include Makefile.inc
73!endif
74
75OBJS = $(CSOURCES:.c=.obj)
76OBJS = $OBJ_DIR\$(OBJS: = $OBJ_DIR\)
77
78#
79# Use $(OBJS) as a template to generate $(OBJS_STAT) and $(OBJS_DYN).
80#
81OBJ_DIR    = $(OBJ_BASE)\stat
82OBJS_STAT  = $+ $(OBJS) $-
83
84OBJ_DIR    = $(OBJ_BASE)\dyn
85OBJS_DYN   = $+ $(OBJS) $-
86
87ARESBUILDH = ares_build.h
88RESOURCE   = $(OBJ_BASE)\dyn\cares.res
89
90all: $(ARESBUILDH) $(OBJ_BASE) $(TARGETS) $(DEMOS) .SYMBOLIC
91	@echo Welcome to cares
92
93$(OBJ_BASE):
94	-$(MD) $^@
95	-$(MD) $^@\stat
96	-$(MD) $^@\dyn
97	-$(MD) $^@\demos
98
99$(ARESBUILDH): .EXISTSONLY
100	$(CP) $^@.dist $^@
101
102$(LIBNAME).dll: $(OBJS_DYN) $(RESOURCE) $(LINK_ARG)
103	$(LD) name $^@ @$]@
104
105$(LIBNAME).lib: $(OBJS_STAT) $(LIB_ARG)
106	$(AR) -q -b -c $^@ @$]@
107
108adig.exe: $(OBJ_BASE)\demos\adig.obj $(OBJ_BASE)\demos\ares_getopt.obj $(LIBNAME).lib
109	$(LD) name $^@ system nt $(LFLAGS) file { $(OBJ_BASE)\demos\ares_getopt.obj $[@ } library $]@, ws2_32.lib
110
111ahost.exe: $(OBJ_BASE)\demos\ahost.obj $(OBJ_BASE)\demos\ares_getopt.obj $(LIBNAME).lib
112	$(LD) name $^@ system nt $(LFLAGS) file { $(OBJ_BASE)\demos\ares_getopt.obj $[@ } library $]@, ws2_32.lib
113
114acountry.exe: $(OBJ_BASE)\demos\acountry.obj $(OBJ_BASE)\demos\ares_getopt.obj $(LIBNAME).lib
115	$(LD) name $^@ system nt $(LFLAGS) file { $(OBJ_BASE)\demos\ares_getopt.obj $[@ } library $]@, ws2_32.lib
116
117clean: .SYMBOLIC
118	-$(RM) $(OBJS_STAT)
119	-$(RM) $(OBJS_DYN)
120	-$(RM) $(RESOURCE) $(LINK_ARG) $(LIB_ARG)
121
122vclean realclean: clean .SYMBOLIC
123	-$(RM) $(TARGETS) $(LIBNAME).map
124	-$(RM) $(DEMOS) $(DEMOS:.exe=.map)
125	-$(RD) $(OBJ_BASE)\stat
126	-$(RD) $(OBJ_BASE)\dyn
127	-$(RD) $(OBJ_BASE)\demos
128	-$(RD) $(OBJ_BASE)
129
130.ERASE
131$(RESOURCE): cares.rc .AUTODEPEND
132	$(RC) $(DEBUG) -q -r -zm -I..\include $(SYS_INCL) $[@ -fo=$^@
133
134.ERASE
135.c{$(OBJ_BASE)\dyn}.obj:
136	$(CC) $(CFLAGS) -bd $[@ -fo=$^@
137
138.ERASE
139.c{$(OBJ_BASE)\stat}.obj:
140	$(CC) $(CFLAGS) -DCARES_STATICLIB $[@ -fo=$^@
141
142.ERASE
143.c{$(OBJ_BASE)\demos}.obj:
144	$(CC) $(CFLAGS) -DCARES_STATICLIB $[@ -fo=$^@
145
146$(LINK_ARG): $(__MAKEFILES__)
147	%create $^@
148	@%append $^@ system nt dll
149	@%append $^@ file { $(OBJS_DYN) }
150	@%append $^@ option res=$(RESOURCE), implib=$(LIBNAME)_imp.lib
151	@%append $^@ $(LFLAGS)
152	@%append $^@ libpath $(SYS_LIBS)
153#	@%append $^@ library clib3r.lib
154!ifdef %use_watt32
155	@%append $^@ library $(%watt_root)\lib\wattcpw_imp.lib
156!else
157	@%append $^@ library ws2_32.lib
158!endif
159
160$(LIB_ARG): $(__MAKEFILES__)
161	%create $^@
162	@for %f in ($(OBJS_STAT)) do @%append $^@ +- %f
163
164
165