| 1 | # This submakefile is included when a module needs to build a library.
|
|---|
| 2 | # For a list of additional variables that can be defined prior to including
|
|---|
| 3 | # this submakefile see build.txt.
|
|---|
| 4 |
|
|---|
| 5 | include common.smak
|
|---|
| 6 |
|
|---|
| 7 | # The rule for building an archive
|
|---|
| 8 | RULES += \
|
|---|
| 9 | $(call FECHO,_@,$$.$(.TARG): $(.OBJS) $(.DEPS))$(NL)\
|
|---|
| 10 | $(call FECHO,_@, $$(DO.LIBRARY))$(NL)
|
|---|
| 11 |
|
|---|
| 12 | # The rule for building the OMF variant of library from a.out format
|
|---|
| 13 | ifneq ($(findstring aout,$(.TKIND)),)
|
|---|
| 14 | # Remove the .a suffix from library name
|
|---|
| 15 | .TARGET := $(patsubst %$A,%,$(.TARGET))
|
|---|
| 16 | # Replace 'aout' with 'omf' in .TKIND
|
|---|
| 17 | .TKIND := $(subst aout,omf,$(.TKIND))
|
|---|
| 18 | # Compute the new output file directory
|
|---|
| 19 | .TKIND.DIR := $(subst $(SPACE),-,$(.TKIND))/
|
|---|
| 20 | # Append the .lib suffix to target name
|
|---|
| 21 | .TARGET := $(.TARGET)$A
|
|---|
| 22 | # Compute the name of target file to build
|
|---|
| 23 | .TARG@OMF := $(.TKIND.DIR)$(.TARGET)
|
|---|
| 24 | # The rule for building the xxx@omf variant of target
|
|---|
| 25 | .PHONY: $(.MODULE)@omf
|
|---|
| 26 | MODULES += $(.MODULE)@omf
|
|---|
| 27 | DO.INSTALL += $(call CP,$.$(.TARG@OMF),$(INS)$(.INSDIR)$(.TARGET))$(NL)
|
|---|
| 28 | .DIRS@OMF := $(dir $.$(.TARG@OMF))
|
|---|
| 29 | TARGDIRS += $(.DIRS@OMF)
|
|---|
| 30 | $(.MODULE)@omf: $(.MODULE) $(.DIRS@OMF) $.$(.TARG@OMF)
|
|---|
| 31 | # bird: Add a dependency rule to help make
|
|---|
| 32 | RULES += \
|
|---|
| 33 | $(call FECHO,_@,$.$(.TARG@OMF): $.$(.TARG))$(NL)
|
|---|
| 34 | endif # neq ($(findstring aout,$(.TKIND)),)
|
|---|
| 35 |
|
|---|
| 36 | include comend.smak
|
|---|