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