| [94] | 1 | # The common submakefile used for building all kinds of targets.
|
|---|
| 2 |
|
|---|
| 3 | ifdef .MODULE
|
|---|
| 4 | # If this is the first target in this module, add it to global variables
|
|---|
| 5 | ifeq ($(findstring $(.MODULE),$(MODULES)),)
|
|---|
| 6 | .PHONY: $(.MODULE)
|
|---|
| 7 | MODULES += $(.MODULE)
|
|---|
| 8 | ifdef .MDESC
|
|---|
| 9 | DO.HELP.MODULES += $(call ECHO, $(.MODULE) - $(.MDESC))$(NL)
|
|---|
| 10 | .MDESC :=
|
|---|
| 11 | endif # def .MDESC
|
|---|
| [148] | 12 | ifdef .MDEP
|
|---|
| 13 | $(.MODULE): $(.MDEP)
|
|---|
| 14 | .MDEP :=
|
|---|
| 15 | endif # def .MDEP
|
|---|
| [94] | 16 | endif # eq ($(findstring $(.MODULE),$(MODULES)),)
|
|---|
| 17 | endif # def .MODULE
|
|---|
| 18 |
|
|---|
| 19 | # Canonicalize target kind to the form objectformat-threadness{-profiling}
|
|---|
| 20 | ifneq ($(findstring aout,$(.TKIND)),)
|
|---|
| 21 | .tmp := aout
|
|---|
| 22 | else
|
|---|
| 23 | .tmp := omf
|
|---|
| 24 | endif # neq ($(findstring aout,$(.TKIND)),)
|
|---|
| 25 | ifneq ($(findstring prof,$(.TKIND)),)
|
|---|
| 26 | .tmp += prof
|
|---|
| 27 | endif # neq ($(findstring prof,$(.TKIND)),)
|
|---|
| [1157] | 28 | ifneq ($(findstring log,$(.TKIND)),)
|
|---|
| 29 | .tmp += log
|
|---|
| 30 | endif # neq ($(findstring log,$(.TKIND)),)
|
|---|
| [94] | 31 | .TKIND := $(.tmp)
|
|---|
| [885] | 32 | ifdef .TKVAR
|
|---|
| 33 | .TKIND.DIR := $(subst $(SPACE),-,$(.TKIND))/$(.TKVAR)/
|
|---|
| 34 | else
|
|---|
| [94] | 35 | .TKIND.DIR := $(subst $(SPACE),-,$(.TKIND))/
|
|---|
| [885] | 36 | endif
|
|---|
| [156] | 37 | .DIRS :=
|
|---|
| [94] | 38 |
|
|---|
| [123] | 39 | ifdef .TARGET
|
|---|
| 40 |
|
|---|
| [94] | 41 | # .TARG is same as .TARGET except that it has a st/ or mt/ prefix
|
|---|
| 42 | .TARG := $(.TKIND.DIR)$(.TARGET)
|
|---|
| [156] | 43 | .DIRS += $.$(.TKIND.DIR)
|
|---|
| [94] | 44 |
|
|---|
| 45 | ifdef .INSDIR
|
|---|
| [578] | 46 | ifndef .NOINST
|
|---|
| [236] | 47 | INS.FILES += $(INS)$(.INSDIR)$(.TARGET)
|
|---|
| 48 | $(INS)$(.INSDIR)$(.TARGET): $.$(.TARG)
|
|---|
| 49 | $(call CP,$<,$@)
|
|---|
| [578] | 50 | endif
|
|---|
| [94] | 51 | endif # def .INSDIR
|
|---|
| 52 |
|
|---|
| [123] | 53 | # We know how to create dependency files for .c and .cpp files
|
|---|
| 54 | .tmp := $(strip $(filter %.c,$(.TSRC)) $(filter %.cpp,$(.TSRC)))
|
|---|
| 55 | ifdef .tmp
|
|---|
| 56 | # Read the dependency file
|
|---|
| 57 | -include $.$(.TKIND.DIR)dep-$(.TARGET).smak
|
|---|
| 58 |
|
|---|
| 59 | TARGDEPEND += $.$(.TKIND.DIR)dep-$(.TARGET).smak
|
|---|
| 60 |
|
|---|
| 61 | ifdef BUILD_DEPS
|
|---|
| 62 | # How to build the dependency file
|
|---|
| 63 | $.$(.TKIND.DIR)dep-$(.TARGET).smak: $(.tmp)
|
|---|
| 64 | $(DO.DEPS)
|
|---|
| 65 | endif # BUILD_DEPS
|
|---|
| 66 | endif # def .tmp
|
|---|
| 67 |
|
|---|
| |
|---|