fritzkink
2023-12-25 d0e7e113635048a7c5d7abd80b5ac76c58408492
commit | author | age
d180f2 1 This is a guide to explain various useful targets in Userland component
2 Makefiles.  There is a set of targets that all Makefiles must include, plus
3 some addtional targets that are there for convenience.
4
5 component-environment-check::
6   This target is an optional target that will be included in most Makefiles
7   automatically.  It is defined in $(WS_MAKE_RULES)/environment.mk which is
8   included by $(WS_MAKE_RULES)/shares-macros.mk.  It reports on some interesting
9   information about the current environment and whether or not it is suitable
10   to build, publish, or test the component.
11
12 component-environment-prep::
13   This target is an optional target that will be included in most Makefiles
14   automatically.  It is defined in $(WS_MAKE_RULES)/environment.mk which is
15   included by $(WS_MAKE_RULES)/shares-macros.mk.  It uses the REQUIRE_PACKAGES
16   macro contents to attempt to install any required packages in the current
bc9b99 17   environment. To use this target user has to be assigned "Software Installation"
AP 18   or "Primary Administrator" profile.
d180f2 19
20 download::
21   This target is present in all Makefiles.  It can be used at the top level
22   to act across all components, or on an individual component basis.  It is
23   typically defined by including $(WS_MAKE_RULES)/prep.mk in your component
24   Makefile.  This target depends on your component Makefile, so changes to your
25   component Makefile will automatically trigger a re-download and subsequent
26   build steps that depend on it.  You can use the MAKEFILE_PREREQ macro to
27   override this behaviour and avoid rebuilding with each Makefile change.  This
28   macro should only be used in the calling environment via something like:
29     $ gmake MAKEFILE_PREREQ= install
30
31 unpack::
32   This target is present in all Makefiles.  It can be used at the top level
33   to act across all components, or on an individual component basis.  It is
34   typically defined by including $(WS_MAKE_RULES)/prep.mk in your component
35   Makefile.  This target depends on the previously described "download" target,
36   This target will unpack any downloaded source archives.  It is an interim
37   step in the source code preparation phase of the build.
38
39 patch::
40   This target is present in all Makefiles.  It can be used at the top level
41   to act across all components, or on an individual component basis.  It is
42   typically defined by including $(WS_MAKE_RULES)/prep.mk in your component
43   Makefile.  This target depends on the previously described "unpack" target,
44   This target will patch any unpacked source.  It is an interim step in the
45   source code preparation phase of the build.
46
47 prep::
48   This target is present in all Makefiles.  It can be used at the top level
49   to act across all components, or on an individual component basis.  It is 
50   typically defined by including $(WS_MAKE_RULES)/prep.mk in your component
51   Makefile.  It depends on the previously described "download" target, as well
52   as internal interim targets to unpack source archives and apply patches to
53   the unpacked source.
54
55 build::
56   This target must be present in all Makefiles.  It can be used at the top level
57   to act across all components, or on an individual component basis.  It is
58   defined in the individual component Makefiles, but most Makefile fragments
59   under $(WS_MAKE_RULES) include targets that allow the definitions to depend
60   on one of several convenience macros $(BUILD_32), $(BUILD_64),
61   $(BUILD_32_and_64), and $(BUILD_NO_ARCH) to build 32-bit support, 64-bit
62   support, both 32 and 64 bit support, or architecture neutral support.  The
63   macro used will depend on the component.
64
65 install::
66   This target must be present in all Makefiles.  It can be used at the top level
67   to act across all components, or on an individual component basis.  It is
68   defined in the individual component Makefiles, but most Makefile fragments
69   under $(WS_MAKE_RULES) include targets that allow the definitions to depend
70   on one of several convenience macros $(INSTALL_32), $(INSTALL_64),
71   $(INSTALL_32_and_64), and $(INSTALL_NO_ARCH) to install 32-bit support, 64-bit
72   support, both 32 and 64 bit support, or architecture neutral support.  The
73   macro used will depend on the component and corresponds to the build target
74   macro used.
75
76 pkglint::
77   This target is an optional target is automatically defined in each Makefile
78   by the inclusion of $(WS_MAKE_RULES)/prep.mk.  It will run the build steps
79   necessary to pkglint the manifests for a component.
80
4221e1 81 pre-publish::
d180f2 82   This target is present in all Makefiles.  It can be used at the top level
83   to act across all components, or on an individual component basis.  It is
84   automatically defined by including $(WS_MAKE_RULES)/ips.mk.  It depends
85   on the previously described 'install' target and will perform a series of
86   internal, intermediate steps to use the component package manifests to
4221e1 87   generate and validate consistency of packages for that component.
JK 88
89   NOTE: The pre-publish target aims to help a recipe developer to make sure
90   that the recipe can produce a valid package without actually pushing its
91   bits into his or her repository (allows to experiment, saves some time, and
92   avoids polluting the repository with known-bad code during development cycles).
93
94 publish::
95   This target is present in all Makefiles.  It can be used at the top level
96   to act across all components, or on an individual component basis.  It is
97   automatically defined by including $(WS_MAKE_RULES)/ips.mk.  It depends
98   on the previously described 'pre-publish' target and will actually publish
99   packages for that component to the repository configured in $(WS_REPO).
d180f2 100
101 clean::
102   This target is present in all Makefiles.  It can be used at the top level
103   to act across all components, or on an individual component basis.  It is
104   often automatically defined by including one of the $(WS_MAKE_RULES)
105   Makefile fragments.  It cleans up any files created by building the component
106   with the exception of any downloaded files.
107
108 clobber::
109   This target is present in all Makefiles.  It can be used at the top level
110   to act across all components, or on an individual component basis.  It is
111   often automatically defined by including one of the $(WS_MAKE_RULES)
112   Makefile fragments.  It depends on the previously described 'clean' target
113   and additionally cleans up any downloaded source archives.  In addition,
114   when done from the top level or component sub-directory, it will do a find
115   of 'manifest-*.published' and clean those up; these can be left over from
116   components that were published but then 'hg rm'd before the next clobber.
117
118 REQUIRED_PACKAGES::
119   This target is present in all component Makefiles.  It is automatically
120   defined by including $(WS_MAKE_RULES)/ips.mk.  It is a convenience that can
121   be used to generate the set of REQUIRED_PACKAGES that is needed by the
122   'pkgdepend resolve' portion of package generation and publication (publish
123   target).  It automatically appends to the component Makefile, but the results
4d720d 124   should be manually verified.
125
627785 126 env-check::
127   This target serves as an alias for component-environment-check target. It exists
128   only for user convenience.
129
130 env-prep::
131   This target serves as an alias for component-environment-prep target. It exists
132   only for user convenience.
133
4d720d 134 print-VAR
135   This target will print contents of variable VAR and also provide information
136   about variable origin and variable flavor.
1da9cc 137
AL 138 print-value-VAR
139   This target will print contents of variable VAR.
140
141 format
142   This target will apply different refactoring rules to update the Makefile
143   to the current style: deprecation of macros, use of new target, autoindent...
144   The rules are implemented in the userland-component utility.
145
146 update
147   This target will format the Makefile then bump the COMPONENT_REVISION variable
148   if no VERSION value is provided. If a VERSION value is provided it will set
149   the COMPONENT_VERSION to the given value and remove COMPONENT_REVISION.
150   For some supported build style it may peform additional actions like:
151   - infering the latest version if VERSION=latest is passed,
152   - updating the archive checksum.
d9c32b 153
AL 154 update-latest
155   This target is a convenience shortcut for 'update VERSION=latest'.