| 1 | # This submakefile is included from mklib.smak and mkimplib.smak to define
 | 
|---|
| 2 | # the rules required for building an OMF variant from the a.out library.
 | 
|---|
| 3 | 
 | 
|---|
| 4 | # The rule for building the OMF variant of library from a.out format
 | 
|---|
| 5 | ifneq ($(findstring aout,$(.TKIND)),)
 | 
|---|
| 6 | 
 | 
|---|
| 7 | # Remove the .a suffix from library name and append .lib instead
 | 
|---|
| 8 | .TARGET := $(patsubst %.a,%.lib,$(.TARGET))
 | 
|---|
| 9 | 
 | 
|---|
| 10 | # Replace 'aout' with 'omf' in .TKIND
 | 
|---|
| 11 | .TKIND := $(subst aout,omf,$(.TKIND))
 | 
|---|
| 12 | 
 | 
|---|
| 13 | # Compute the new output file directory
 | 
|---|
| 14 | ifdef .TKVAR
 | 
|---|
| 15 | .TKIND.DIR := $(subst $(SPACE),-,$(.TKIND))/$(.TKVAR)/
 | 
|---|
| 16 | else
 | 
|---|
| 17 | .TKIND.DIR := $(subst $(SPACE),-,$(.TKIND))/
 | 
|---|
| 18 | endif
 | 
|---|
| 19 | 
 | 
|---|
| 20 | # Compute the name of target file to build
 | 
|---|
| 21 | .TARG@OMF := $(.TKIND.DIR)$(.TARGET)
 | 
|---|
| 22 | 
 | 
|---|
| 23 | # The rule for building the xxx@omf variant of target
 | 
|---|
| 24 | .PHONY: $(.MODULE)@omf
 | 
|---|
| 25 | 
 | 
|---|
| 26 | # Add this module to the list of all modules
 | 
|---|
| 27 | MODULES += $(.MODULE)@omf
 | 
|---|
| 28 | # ... and to the list of libraries
 | 
|---|
| 29 | libs: $(.MODULE)@omf
 | 
|---|
| 30 | 
 | 
|---|
| 31 | INS.FILES += $(INS)$(.INSDIR)$(.TARGET)
 | 
|---|
| 32 | $(INS)$(.INSDIR)$(.TARGET): $.$(.TARG@OMF)
 | 
|---|
| 33 |         $(call CP,$<,$@)
 | 
|---|
| 34 | 
 | 
|---|
| 35 | .DIRS@OMF := $(dir $.$(.TARG@OMF))
 | 
|---|
| 36 | 
 | 
|---|
| 37 | TARGDIRS += $(.DIRS@OMF)
 | 
|---|
| 38 | 
 | 
|---|
| 39 | $(.MODULE)@omf: $(.MODULE) $(.DIRS@OMF) $.$(.TARG@OMF)
 | 
|---|
| 40 | 
 | 
|---|
| 41 | # Add a dependency rule to help make
 | 
|---|
| 42 | # (avoids that dumb 'dunno how to make' message)
 | 
|---|
| 43 | $.$(.TARG@OMF): $.$(.TARG)
 | 
|---|
| 44 | 
 | 
|---|
| 45 | endif # neq ($(findstring aout,$(.TKIND)),)
 | 
|---|