[4656] | 1 | # $Id: pdwin32.wat.post,v 1.8 2000-11-21 04:39:20 bird Exp $
|
---|
[4075] | 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.)
|
---|
[4642] | 11 | # Define LIBTARGET to make an internal library.
|
---|
[4075] | 12 | # Define LOCALCLEAN if only the local directory is to be clean.
|
---|
| 13 | # Define CLEAN2 to invoke a second clean rule named 'clean2'.
|
---|
[4288] | 14 | # Define NOCLEAN to exclude the clean rule. (Remember to make your own!)
|
---|
[4075] | 15 | #
|
---|
[4642] | 16 | # New style: (!defined OLD_STYLE)
|
---|
[4334] | 17 | # Define NO_ALL_RULE to not make default all rule.
|
---|
| 18 | # Define NO_LIB_RULE to not make default lib rule.
|
---|
[4642] | 19 | # Define NO_MAIN_RULE to not make default main target rule.
|
---|
[4334] | 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!).
|
---|
[4642] | 23 | # Define NO_INTERNAL_LIBS to not include libs rule for subdirectories.
|
---|
| 24 | # Define NO_MAIN_BIN_COPY to not copy the target and sym file to the main
|
---|
| 25 | # binary directory. It is only copied to the compiler specific directory.
|
---|
| 26 | # Main bin is /bin. Compiler specific bin is /bin/debug, /bin/debug.vac36, etc.
|
---|
| 27 | # Define ADDITIONAL_DEP to add dependencies rules.
|
---|
[4334] | 28 | #
|
---|
[4642] | 29 | # Define MAKEFILE if the name of the makefile isn't "makefile".
|
---|
| 30 | # Define DEFFILE to specify another file than $(TARGET).def or $(ORGTARGET).def.
|
---|
| 31 | # Define this if your .exe file have a .def file.
|
---|
| 32 | # Define OS2RES as the names of the OS/2 .res file to create and link
|
---|
| 33 | # with the target .dll or .exe.
|
---|
| 34 | # Define LIBS as a list of all the libraries to link
|
---|
| 35 | # with the target .dll or .exe.
|
---|
| 36 | # Define SUBDIRS when you have subdirectories which should be made.
|
---|
| 37 | # dep and lib supports this fully. The rule libs are added, since we assume you
|
---|
| 38 | # makes internal libraries in the subdirectories. The libs rule is one of the
|
---|
| 39 | # dependencies of the main target.
|
---|
| 40 | #
|
---|
[4075] | 41 |
|
---|
[4656] | 42 |
|
---|
[4547] | 43 | !ifndef TARGET_EXTENSION
|
---|
[4656] | 44 | ! ifdef LIBTARGET
|
---|
| 45 | TARGET_EXTENSION=lib
|
---|
| 46 | ! else
|
---|
| 47 | ! ifdef EXETARGET
|
---|
[4547] | 48 | TARGET_EXTENSION=exe
|
---|
[4642] | 49 | ! else
|
---|
[4547] | 50 | TARGET_EXTENSION=dll
|
---|
[4642] | 51 | ! endif
|
---|
| 52 | ! endif
|
---|
[4547] | 53 | !endif
|
---|
[4642] | 54 |
|
---|
| 55 |
|
---|
| 56 | !ifndef OLD_STYLE
|
---|
| 57 |
|
---|
| 58 | # Set default MAKEFILE if needed
|
---|
| 59 | !ifndef MAKEFILE
|
---|
| 60 | MAKEFILE = makefile
|
---|
[4547] | 61 | !endif
|
---|
[4075] | 62 |
|
---|
[4642] | 63 | # Set default ORGTARGET if needed.
|
---|
| 64 | !ifndef ORGTARGET
|
---|
| 65 | ORGTARGET=$(TARGET)
|
---|
| 66 | !endif
|
---|
[4547] | 67 |
|
---|
[4642] | 68 | # Set default DEFFILE if needed. (Currently for dlls only.)
|
---|
| 69 | !ifndef DEFFILE
|
---|
| 70 | ! ifndef EXETARGET
|
---|
| 71 | DEFFILE = $(ORGTARGET).def
|
---|
| 72 | ! endif
|
---|
| 73 | !endif
|
---|
| 74 |
|
---|
| 75 | # Set INTLIBS (interal) if SUBDIRS is defined and NO_INTERNAL_LIBS is undefined.
|
---|
| 76 | !ifdef SUBDIRS
|
---|
| 77 | ! ifndef NO_INTERNAL_LIBS
|
---|
| 78 | ! ifndef LIBTARGET
|
---|
| 79 | INTLIBS = libs
|
---|
| 80 | ! else
|
---|
| 81 | INTLIBS = libs_sub
|
---|
| 82 | ! endif
|
---|
| 83 | ! endif
|
---|
| 84 | !endif
|
---|
| 85 |
|
---|
| 86 |
|
---|
| 87 | !ifndef LIBTARGET
|
---|
[4334] | 88 | !ifndef EXETARGET
|
---|
[4642] | 89 | ###############################################################################
|
---|
| 90 | # DLL Target
|
---|
| 91 | ###############################################################################
|
---|
[4334] | 92 |
|
---|
[4642] | 93 | #
|
---|
| 94 | # Dll: All rule - build objs, target dll, copies target to bin and makes libs.
|
---|
| 95 | #
|
---|
[4334] | 96 | !ifndef NO_ALL_RULE
|
---|
| 97 | all: $(OBJDIR) \
|
---|
[4642] | 98 | $(INTLIBS) \
|
---|
[4547] | 99 | $(OBJDIR)\$(TARGET).$(TARGET_EXTENSION) \
|
---|
[4642] | 100 | $(OBJDIR)\$(TARGET).sym \
|
---|
[4547] | 101 | $(PDWIN32_BIN)\$(TARGET).$(TARGET_EXTENSION) \
|
---|
[4642] | 102 | $(PDWIN32_BIN)\$(TARGET).sym \
|
---|
[4656] | 103 | lib \
|
---|
| 104 | .SYMBOLIC
|
---|
[4334] | 105 | !endif
|
---|
| 106 |
|
---|
[4642] | 107 | #
|
---|
| 108 | # Dll: Lib rule - build importlibrary (and evt. other libs)
|
---|
| 109 | #
|
---|
[4334] | 110 | !ifndef NO_LIB_RULE
|
---|
[4642] | 111 | lib: $(ORGTARGET).lib $(PDWIN32_LIB)\$(ORGTARGET).lib
|
---|
[4334] | 112 | !endif
|
---|
| 113 |
|
---|
| 114 |
|
---|
[4642] | 115 | #
|
---|
| 116 | # Dll: Main target rule - builds the target dll.
|
---|
| 117 | #
|
---|
| 118 | !ifndef NO_MAIN_RULE
|
---|
| 119 | $(OBJDIR)\$(TARGET).$(TARGET_EXTENSION): $(OBJS) $(OS2RES) $(DEFFILE) $(OBJDIR)\$(TARGET).lrf
|
---|
| 120 | $(LD2) @$(OBJDIR)\$(TARGET).lrf
|
---|
| 121 | !ifdef OS2RES
|
---|
| 122 | $(OS2RC) $(OS2RCLFLAGS) $(OS2RES) $@
|
---|
[4334] | 123 | !endif
|
---|
[4642] | 124 | !endif
|
---|
[4334] | 125 |
|
---|
| 126 |
|
---|
[4642] | 127 | #
|
---|
| 128 | # Dll: Linker file - creates the parameter file passed on to the linker.
|
---|
| 129 | #
|
---|
[4334] | 130 | !ifndef NO_LNKFILE_RULE
|
---|
[4647] | 131 | $(OBJDIR)\$(TARGET).lrf: makefile $(DEFFILE) $(PDWIN32_INCLUDE)\pdwin32.wat.post
|
---|
| 132 | $(RM) $(OBJDIR)\$(TARGET).lrf2 $@
|
---|
| 133 | $(KDEF2WAT) $(DEFFILE) $@ <<$(OBJDIR)\$(TARGET).lrf2
|
---|
[4334] | 134 | $(LD2FLAGS)
|
---|
[4547] | 135 | name $(OBJDIR)\$(TARGET).$(TARGET_EXTENSION)
|
---|
[4334] | 136 | option map=$(OBJDIR)\$(TARGET).map
|
---|
| 137 | file {$(OBJS)}
|
---|
| 138 | library {$(LIBS)}
|
---|
[4401] | 139 | <<
|
---|
[4334] | 140 | !endif
|
---|
| 141 |
|
---|
| 142 |
|
---|
| 143 | !else # !ifndef EXETARGET
|
---|
[4642] | 144 | ###############################################################################
|
---|
| 145 | # EXE Target
|
---|
| 146 | ###############################################################################
|
---|
[4334] | 147 |
|
---|
[4642] | 148 | #
|
---|
| 149 | # Exe: All rule - build objs, target exe, copies target to bin.
|
---|
| 150 | #
|
---|
[4334] | 151 | !ifndef NO_ALL_RULE
|
---|
| 152 | all: $(OBJDIR) \
|
---|
[4642] | 153 | $(INTLIBS) \
|
---|
[4547] | 154 | $(OBJDIR)\$(TARGET).$(TARGET_EXTENSION) \
|
---|
[4642] | 155 | $(OBJDIR)\$(TARGET).sym \
|
---|
| 156 | $(PDWIN32_BIN)\$(TARGET).$(TARGET_EXTENSION) \
|
---|
[4656] | 157 | $(PDWIN32_BIN)\$(TARGET).sym \
|
---|
| 158 | .SYMBOLIC
|
---|
[4334] | 159 | !endif
|
---|
| 160 |
|
---|
[4642] | 161 | #
|
---|
| 162 | # Exe: Lib rule - dummy rule
|
---|
| 163 | #
|
---|
[4334] | 164 | !ifndef NO_LIB_RULE
|
---|
[4656] | 165 | lib: .SYMBOLIC
|
---|
[4334] | 166 | !endif
|
---|
| 167 |
|
---|
| 168 |
|
---|
[4642] | 169 | #
|
---|
| 170 | # Exe: Main target rule - builds the target exe.
|
---|
| 171 | #
|
---|
| 172 | !ifndef NO_MAIN_RULE
|
---|
| 173 | $(OBJDIR)\$(TARGET).$(TARGET_EXTENSION): $(OBJS) $(OS2RES) $(DEFFILE) $(OBJDIR)\$(TARGET).lrf
|
---|
| 174 | $(LD2) @$(OBJDIR)\$(TARGET).lrf
|
---|
| 175 | !ifdef OS2RES
|
---|
| 176 | $(OS2RC) $(OS2RCLFLAGS) $(OS2RES) $@
|
---|
[4334] | 177 | !endif
|
---|
[4642] | 178 | !endif
|
---|
[4334] | 179 |
|
---|
| 180 |
|
---|
[4642] | 181 | #
|
---|
| 182 | # Exe: Linker file - creates the parameter file passed on to the linker.
|
---|
| 183 | #
|
---|
[4334] | 184 | !ifndef NO_LNKFILE_RULE
|
---|
[4647] | 185 | $(OBJDIR)\$(TARGET).lrf: makefile $(PDWIN32_INCLUDE)\pdwin32.wat.post $(DEFFILE)
|
---|
| 186 | $(RM) $(OBJDIR)\$(TARGET).lrf2 $@
|
---|
| 187 | !ifdef DEFFILE
|
---|
| 188 | $(KDEF2WAT) $(DEFFILE) $@ <<$(OBJDIR)\$(TARGET).lrf2
|
---|
| 189 | !else
|
---|
| 190 | $(ECHO) Creating <<$@
|
---|
| 191 | !endif
|
---|
[4401] | 192 | $(LD2FLAGS)
|
---|
[4547] | 193 | name $(OBJDIR)\$(TARGET).$(TARGET_EXTENSION)
|
---|
[4401] | 194 | option map=$(OBJDIR)\$(TARGET).map
|
---|
| 195 | file {$(OBJS)}
|
---|
| 196 | library {$(LIBS)}
|
---|
| 197 | <<
|
---|
[4334] | 198 | !endif
|
---|
| 199 |
|
---|
[4642] | 200 | !endif # !ifndef EXETARGET !else
|
---|
| 201 | !else # !ifndef LIBTARGET
|
---|
| 202 | ###############################################################################
|
---|
| 203 | # LIB target (internal object library)
|
---|
| 204 | ###############################################################################
|
---|
[4334] | 205 |
|
---|
[4642] | 206 | #
|
---|
| 207 | # Localcleanup is default for internal object libraries.
|
---|
| 208 | #
|
---|
| 209 | LOCALCLEAN = 1
|
---|
| 210 |
|
---|
| 211 |
|
---|
| 212 | #
|
---|
| 213 | # Lib: All rule - build objs and target library.
|
---|
| 214 | #
|
---|
| 215 | !ifndef NO_ALL_RULE
|
---|
| 216 | all: $(OBJDIR) \
|
---|
| 217 | $(INTLIBS) \
|
---|
[4656] | 218 | $(OBJDIR)\$(TARGET).$(TARGET_EXTENSION) \
|
---|
| 219 | .SYMBOLIC
|
---|
[4334] | 220 | !endif
|
---|
| 221 |
|
---|
| 222 |
|
---|
[4642] | 223 | #
|
---|
| 224 | # Lib: Lib rule - dummy rule
|
---|
| 225 | #
|
---|
| 226 | !ifndef NO_LIB_RULE
|
---|
[4656] | 227 | lib: .SYMBOLIC
|
---|
[4642] | 228 | !endif
|
---|
[4334] | 229 |
|
---|
| 230 |
|
---|
[4642] | 231 | #
|
---|
| 232 | # Lib: Internal library rule. Same as the all rule.
|
---|
| 233 | #
|
---|
| 234 | !ifndef NO_INTERNAL_LIBS
|
---|
[4656] | 235 | libs: all .SYMBOLIC
|
---|
[4642] | 236 | !endif
|
---|
[4334] | 237 |
|
---|
| 238 |
|
---|
[4642] | 239 | #
|
---|
| 240 | # Lib: Main target rule - builds the target internal library.
|
---|
| 241 | # (fixme)
|
---|
| 242 | !ifndef NO_MAIN_RULE
|
---|
| 243 | $(OBJDIR)\$(TARGET).$(TARGET_EXTENSION): $(OBJS)
|
---|
| 244 | $(RM) $@
|
---|
| 245 | $(ILIB) $(ILIBFLAGS) $@ @<<
|
---|
| 246 | $(OBJS: =&^
|
---|
| 247 | )
|
---|
[4656] | 248 | $(OBJDIR)\$^&.lst
|
---|
[4642] | 249 | <<
|
---|
| 250 | !endif
|
---|
| 251 |
|
---|
| 252 |
|
---|
| 253 | !endif # !ifndef LIBTARGET
|
---|
| 254 |
|
---|
| 255 |
|
---|
| 256 | ###############################################################################
|
---|
| 257 | # Common rules for both exe and dll, new style
|
---|
| 258 | ###############################################################################
|
---|
| 259 |
|
---|
| 260 | #
|
---|
| 261 | # Common (new): Dep rule - makes depenencies for C, C++ and Asm files.
|
---|
| 262 | #
|
---|
| 263 | !ifndef NO_DEP_RULE
|
---|
[4656] | 264 | dep: dep_internal $(ADDITIONAL_DEP) .SYMBOLIC
|
---|
| 265 | dep_internal: .SYMBOLIC
|
---|
[4642] | 266 | $(DEPEND) $(CINCLUDES) *.c *.cpp *.h *.asm *.inc \
|
---|
| 267 | *.rc *.dlg $(PDWIN32_INCLUDE)\*.h -robj *.orc
|
---|
| 268 | !ifdef SUBDIRS
|
---|
| 269 | $(DODIRS) "$(SUBDIRS)" $(MAKE_CMD) dep
|
---|
| 270 | !endif
|
---|
| 271 | !endif
|
---|
| 272 |
|
---|
| 273 |
|
---|
| 274 | #
|
---|
| 275 | # Common: Internal library rule. Make libraries in subdirectories.
|
---|
| 276 | # For makefiles with subdirectories is common to have make libraries in subdirectories.
|
---|
| 277 | #
|
---|
| 278 | !ifndef NO_INTERNAL_LIBS
|
---|
| 279 | !ifdef INTLIBS
|
---|
[4656] | 280 | $(INTLIBS): .SYMBOLIC
|
---|
[4642] | 281 | $(DODIRS) "$(SUBDIRS)" $(MAKE_CMD) libs
|
---|
| 282 | !endif
|
---|
| 283 | !endif
|
---|
| 284 |
|
---|
| 285 | !endif # OLD_STYLE
|
---|
| 286 |
|
---|
| 287 | ###############################################################################
|
---|
| 288 | # Common rules for both exe and dll, old and new style.
|
---|
| 289 | ###############################################################################
|
---|
| 290 |
|
---|
| 291 | #
|
---|
| 292 | # Common: Copy library rule.
|
---|
| 293 | #
|
---|
[4075] | 294 | $(PDWIN32_LIB)\$(ORGTARGET).lib: $(ORGTARGET).lib
|
---|
[4656] | 295 | @if not exist $^: $(CREATEPATH) $^:
|
---|
| 296 | $(CP) $[@ $@
|
---|
[4642] | 297 |
|
---|
| 298 |
|
---|
| 299 | #
|
---|
| 300 | # Common: Copy dll/exe rule.
|
---|
| 301 | #
|
---|
| 302 | $(PDWIN32_BIN)\$(TARGET).$(TARGET_EXTENSION): $(OBJDIR)\$(TARGET).$(TARGET_EXTENSION)
|
---|
[4656] | 303 | @if not exist $^: $(CREATEPATH) $^:
|
---|
| 304 | $(CP) $[@ $^@
|
---|
[4642] | 305 | !ifndef NO_MAIN_BIN_COPY
|
---|
[4656] | 306 | -$(CP) $[@ $^:..\..\$^.
|
---|
[4075] | 307 | !endif
|
---|
[4642] | 308 |
|
---|
| 309 |
|
---|
| 310 | #
|
---|
| 311 | # Common: Copy sym rule.
|
---|
| 312 | #
|
---|
| 313 | $(PDWIN32_BIN)\$(TARGET).sym: $(OBJDIR)\$(TARGET).sym
|
---|
[4656] | 314 | @if not exist $^: $(CREATEPATH) $^:
|
---|
| 315 | $(CP) $[@ $@
|
---|
[4642] | 316 | !ifndef NO_MAIN_BIN_COPY
|
---|
[4656] | 317 | -$(CP) $[@ $^:..\..\$^.
|
---|
[4642] | 318 | !endif
|
---|
[4075] | 319 |
|
---|
| 320 |
|
---|
[4642] | 321 | #
|
---|
| 322 | # Common: Make sym file rule.
|
---|
| 323 | #
|
---|
| 324 | $(OBJDIR)\$(TARGET).sym: $(OBJDIR)\$(TARGET).map
|
---|
[4075] | 325 | cd $(OBJDIR)
|
---|
| 326 | $(MAPSYM) $(TARGET).map
|
---|
| 327 | cd ..\..
|
---|
| 328 |
|
---|
| 329 |
|
---|
[4642] | 330 | #
|
---|
| 331 | # Common: Make library from the <>exp.def or the <>.def file.
|
---|
| 332 | #
|
---|
[4075] | 333 | !ifndef NOTEXPDEF
|
---|
[4642] | 334 | $(ORGTARGET).lib: $(ORGTARGET)exp.def
|
---|
[4656] | 335 | $(IMPLIB) $(IMPLIBFLAGS) $@ $[@
|
---|
[4075] | 336 | !else
|
---|
[4642] | 337 | $(TARGET).lib: $(DEFFILE)
|
---|
[4656] | 338 | $(IMPLIB) $(IMPLIBFLAGS) $@ $[@
|
---|
[4075] | 339 | !endif
|
---|
| 340 |
|
---|
| 341 |
|
---|
[4642] | 342 | #
|
---|
| 343 | # Common: Make the <>exp.def file.
|
---|
| 344 | #
|
---|
| 345 | !ifndef NOTEXPDEF
|
---|
| 346 | $(ORGTARGET)exp.def: $(DEFFILE)
|
---|
[4656] | 347 | $(IMPDEF) $[@ $@
|
---|
[4075] | 348 | !endif
|
---|
| 349 |
|
---|
| 350 |
|
---|
[4642] | 351 | #
|
---|
| 352 | # Common: Create the object directory.
|
---|
| 353 | #
|
---|
[4075] | 354 | $(OBJDIR): .SYMBOLIC
|
---|
[4642] | 355 | @if not exist $(OBJDIR) $(CREATEPATH) $(OBJDIR)
|
---|
[4075] | 356 |
|
---|
| 357 |
|
---|
| 358 | #
|
---|
[4642] | 359 | # Common: General clean rule. To clean more add it to CLEANEXTRAS!
|
---|
[4075] | 360 | #
|
---|
[4288] | 361 | !ifndef NOCLEAN
|
---|
[4075] | 362 | !ifndef CLEAN2
|
---|
[4656] | 363 | clean: .SYMBOLIC
|
---|
[4075] | 364 | !else
|
---|
[4656] | 365 | clean: clean2 .SYMBOLIC
|
---|
[4075] | 366 | !endif
|
---|
[4642] | 367 | $(RM) *.lib *.res *.map *.pch \
|
---|
[4075] | 368 | !if "$(OBJDIR)" != ""
|
---|
| 369 | $(OBJDIR)\* \
|
---|
| 370 | !endif
|
---|
| 371 | !ifndef LOCALCLEAN
|
---|
[4642] | 372 | $(PDWIN32_LIB)\$(ORGTARGET).lib \
|
---|
| 373 | $(ORGTARGET)exp.def \
|
---|
[4547] | 374 | $(PDWIN32_BIN)\$(TARGET).$(TARGET_EXTENSION) *.$(TARGET_EXTENSION) \
|
---|
| 375 | $(PDWIN32_BIN)\$(TARGET).sym *.sym \
|
---|
[4075] | 376 | $(CLEANEXTRAS)
|
---|
| 377 | !else
|
---|
| 378 | $(CLEANEXTRAS)
|
---|
| 379 | !endif
|
---|
[4288] | 380 | !endif
|
---|
[4642] | 381 | !ifdef SUBDIRS
|
---|
| 382 | $(DODIRS) "$(SUBDIRS)" $(MAKE_CMD) clean
|
---|
[4334] | 383 | !endif
|
---|
[4075] | 384 |
|
---|
| 385 |
|
---|
[4642] | 386 | #
|
---|
| 387 | # Common: Include the .depend file.
|
---|
| 388 | # If the depend file don't exists we'll complain about it.
|
---|
| 389 | #
|
---|
| 390 | #!ifndef NODEP
|
---|
| 391 | #! if [$(EXISTS) .depend] == 0
|
---|
| 392 | #! include .depend
|
---|
| 393 | #! else
|
---|
| 394 | #! if [$(ECHO) .depend doesn't exist]
|
---|
| 395 | #! endif
|
---|
| 396 | #! endif
|
---|
| 397 | #!endif
|
---|
| 398 |
|
---|