source: trunk/include/pdwin32.wat.post@ 4564

Last change on this file since 4564 was 4547, checked in by bird, 25 years ago

Changed cleanrule to remove .sym files too.
Synced Watcom file with the other one.

File size: 4.9 KB
Line 
1# $Id: pdwin32.wat.post,v 1.5 2000-11-01 01:34:19 bird Exp $
2#
3# Odin32 API
4#
5# Common dll makefile rules (must be included at the last line of the makefile)
6#
7# If ORGTARGET is defined it is used to generate the importlibrary.
8#
9# Define NOTEXPDEF to remove the $(TARGET).lib and $(TARGET)exp.def rules.
10# Define EXETARGET to make an executable. (This also applies to pdwin32.mk.)
11# Define LOCALCLEAN if only the local directory is to be clean.
12# Define CLEAN2 to invoke a second clean rule named 'clean2'.
13# Define NOCLEAN to exclude the clean rule. (Remember to make your own!)
14#
15# New style: (define NEW_STYLE)
16# Define NO_ALL_RULE to not make default all rule.
17# Define NO_LIB_RULE to not make default lib rule.
18# Define NO_DLL_RULE to not make default dll rule.
19# Define NO_EXE_RULE to not make default exe rule.
20# Define NO_LNKFILE_RULE to not make default link-file rule.
21# Define NO_DEP_RULE to not make dependencies rule.
22# Define NO_CLEAN_RULE to not make clean rule (same as NOCLEAN - use this!).
23#
24
25!ifndef TARGET_EXTENSION
26!ifdef EXETARGET
27TARGET_EXTENSION=exe
28!else
29TARGET_EXTENSION=dll
30!endif
31!endif
32
33
34!ifdef NEW_STYLE
35!ifndef EXETARGET
36
37
38# All rule - build objs, target dll, copies target to bin and makes libs.
39!ifndef NO_ALL_RULE
40all: $(OBJDIR) \
41 $(OBJDIR)\$(TARGET).$(TARGET_EXTENSION) \
42 $(PDWIN32_BIN)\$(TARGET).$(TARGET_EXTENSION) \
43 lib
44!endif
45
46
47# Lib rule - build importlibrary (and evt. other libs)
48!ifndef NO_LIB_RULE
49lib: $(TARGET).lib $(PDWIN32_LIB)\$(TARGET).lib
50!endif
51
52
53# Dll rule - builds the target dll.
54!ifndef NO_DLL_RULE
55$(OBJDIR)\$(TARGET).$(TARGET_EXTENSION): $(OBJS) $(OBJDIR)\$(TARGET).lnk
56 $(LD2) @$(OBJDIR)\$(TARGET).lnk
57!endif
58
59
60# Linker file - creates the parameter file passed on to the linker.
61!ifndef NO_LNKFILE_RULE
62$(OBJDIR)\$(TARGET).lnk: makefile $(TARGET).def $(PDWIN32_INCLUDE)\pdwin32.wat.post
63 $(RM) $(OBJDIR)\$(TARGET).lnk2 $@
64 $(KDEF2WAT) $(TARGET).def $@ <<$(OBJDIR)\$(TARGET).lnk2
65$(LD2FLAGS)
66name $(OBJDIR)\$(TARGET).$(TARGET_EXTENSION)
67option map=$(OBJDIR)\$(TARGET).map
68file {$(OBJS)}
69library {$(LIBS)}
70<<
71!endif
72
73
74# Dep rule - makes depenencies for C, C++ and Asm files.
75!ifndef NO_DEP_RULE
76dep:
77 $(DEPEND) -I$(PDWIN32_INCLUDE);$(PDWIN32_INCLUDE)\win \
78 *.c *.cpp *.h *.asm *.inc $(PDWIN32_INCLUDE)\*.h
79!endif
80
81!else # !ifndef EXETARGET
82
83
84# All rule - build objs, target exe, copies target to bin.
85!ifndef NO_ALL_RULE
86all: $(OBJDIR) \
87 $(OBJDIR)\$(TARGET).$(TARGET_EXTENSION) \
88 $(PDWIN32_BIN)\$(TARGET).$(TARGET_EXTENSION)
89!endif
90
91
92# Lib rule - dummy rule
93!ifndef NO_LIB_RULE
94lib:
95!endif
96
97
98# Exe rule - builds the target exe.
99!ifndef NO_EXE_RULE
100$(OBJDIR)\$(TARGET).$(TARGET_EXTENSION): $(OBJSNOOBJDIR) $(TARGET).def $(OBJDIR)\$(TARGET).lnk
101 $(LD2) $(LD2FLAGS) @$(OBJDIR)\$(TARGET).lnk
102!endif
103
104
105# Linker file - creates the parameter file passed on to the linker.
106!ifndef NO_LNKFILE_RULE
107$(OBJDIR)\$(TARGET).lnk: makefile $(PDWIN32_INCLUDE)\pdwin32.wat.post
108 $(RM) $(OBJDIR)\$(TARGET).lnk2 $@
109 $(KDEF2WAT) $(TARGET).def $@ <<$(OBJDIR)\$(TARGET).lnk2
110$(LD2FLAGS)
111name $(OBJDIR)\$(TARGET).$(TARGET_EXTENSION)
112option map=$(OBJDIR)\$(TARGET).map
113file {$(OBJS)}
114library {$(LIBS)}
115<<
116!endif
117
118
119# Dep rule - makes depenencies for C, C++ and Asm files.
120!ifndef NO_DE_PRULE
121dep:
122 $(DEPEND) -I$(PDWIN32_INCLUDE);$(PDWIN32_INCLUDE)\win \
123 *.c *.cpp *.h *.asm *.inc $(PDWIN32_INCLUDE)\*.h
124!endif
125
126
127!endif # EXETARGET
128!endif # NEW_STYLE
129
130
131
132
133# Copy library rule.
134!ifndef ORGTARGET
135$(PDWIN32_LIB)\$(TARGET).lib: $(TARGET).lib
136!else
137$(PDWIN32_LIB)\$(ORGTARGET).lib: $(ORGTARGET).lib
138!endif
139 $(CP) $** $@
140
141
142# Copy dll rule.
143$(PDWIN32_BIN)\$(TARGET).$(TARGET_EXTENSION): $(OBJDIR)\$(TARGET).$(TARGET_EXTENSION)
144 cd $(OBJDIR)
145 $(MAPSYM) $(TARGET).map
146 cd ..\..
147 $(CP) $(OBJDIR)\$(TARGET).sym $(PDWIN32_BIN)
148 $(CP) $** $@
149 -$(CP) $** $(@D)..\..\$(@F)
150 -$(CP) $(OBJDIR)\$(TARGET).sym $(@D)..\..
151
152
153!ifndef NOTEXPDEF
154# make library from the <>exp.def file.
155!ifndef ORGTARGET
156$(TARGET).LIB: $(TARGET)exp.def
157!else
158$(ORGTARGET).LIB: $(ORGTARGET)exp.def
159!endif
160 $(IMPLIB) $(IMPLIBFLAGS) $@ $**
161 $(CP) $@ $(PDWIN32_LIB)
162
163
164# make the <>exp.def file.
165!ifndef ORGTARGET
166$(TARGET)exp.def: $(TARGET).def
167!else
168$(ORGTARGET)exp.def: $(ORGTARGET).def
169!endif
170 $(IMPDEF) $** $@
171!endif
172
173
174# Create the object directory.
175$(OBJDIR): .SYMBOLIC
176 @if not exist bin $(MKDIR) bin
177 @if not exist $(OBJDIR) $(MKDIR) $(OBJDIR)
178
179
180#
181# General clean rule. To clean more add it to CLEANEXTRAS!
182#
183!ifndef NOCLEAN
184!ifndef NO_CLEAN_RULE
185!ifndef CLEAN2
186clean: .SYMBOLIC
187!else
188clean: clean2
189!endif
190 $(RM) *.LIB *.res *.map *.pch *.orc_asm \
191!if "$(OBJDIR)" != ""
192 $(OBJDIR)\* \
193!endif
194!ifndef LOCALCLEAN
195 $(PDWIN32_LIB)\$(TARGET).LIB \
196 $(TARGET)exp.def \
197 $(PDWIN32_BIN)\$(TARGET).$(TARGET_EXTENSION) *.$(TARGET_EXTENSION) \
198 $(PDWIN32_BIN)\$(TARGET).sym *.sym \
199 $(CLEANEXTRAS)
200!else
201 $(CLEANEXTRAS)
202!endif
203!endif
204!endif
205
206
Note: See TracBrowser for help on using the repository browser.