RepositoryRules: RepositoryConfig does not need/use URL now.
[haiku.git] / build / jam / CommandLineArguments
blob033d5652dcc79be80186962c2eb7180dba82b323
1 # Rules related to processing of jam command line arguments.
3 rule ProcessCommandLineArguments
5         # analyze and optionally replace jam's target parameters
6         HAIKU_ORIGINAL_JAM_TARGETS = $(JAM_TARGETS) ;
7         HAIKU_BUILD_PROFILE = ;
8         if $(JAM_TARGETS) {
9                 switch $(JAM_TARGETS[1]) {
10                         # If the target to be built is "all" (i.e. the default) and we're in
11                         # the output directory, the root directory of the build system, or
12                         # in "src/", we change the target to be built to "haiku-image".
13                         case all : {
14                                 if ! $(INVOCATION_SUBDIR) || $(INVOCATION_SUBDIR) = src {
15                                         JAM_TARGETS = haiku-image ;
16                                 }
17                         }
19                         # Print usage text.
20                         case help : {
21                                 Echo "Individual targets (applications, libraries, drivers,"
22                                         "...) can be built by just" ;
23                                 Echo "passing them as arguments to jam. The recommended method"
24                                         "to build or update a" ;
25                                 Echo "Haiku image or installation is to use a build profile"
26                                         "with one of the build" ;
27                                 Echo "profile actions. Typical command lines using a build"
28                                         "profile looks like this:" ;
29                                 Echo "  jam @image" ;
30                                 Echo "  jam @install update libbe.so" ;
31                                 Echo "  jam @vmware-image mount" ;
32                                 Echo ;
33                                 Echo "Default build profiles (minimal set of packages and"
34                                         "configuration):" ;
35                                 Echo "  image            - A raw disk image." ;
36                                 Echo "  anyboot-image    - A custom image for either CD or"
37                                         "disk." ;
38                                 Echo "  cd-image         - An ISO9660 CD image." ;
39                                 Echo "  vmware-image     - A VMware disk image." ;
40                                 Echo "  install          - A Haiku installation in a"
41                                         "directory." ;
42                                 Echo ;
43                                 Echo "Nightly build profiles (small set of packages used in"
44                         "nightly builds and default configuration):" ;
45                                 Echo "  nightly-raw      - A raw disk image." ;
46                                 Echo "  nightly-anyboot  - A custom image for either CD or"
47                                         "disk." ;
48                                 Echo "  nightly-cd       - An ISO9660 CD image." ;
49                                 Echo "  nightly-vmware   - A VMware disk image." ;
50                                 Echo ;
51                                 Echo "Release build profiles (bigger and more complete set of"
52                                         "packages used in releases and default configuration):" ;
53                                 Echo "  release-raw      - A raw disk image." ;
54                                 Echo "  release-anyboot  - A custom image for either CD or"
55                                         "disk." ;
56                                 Echo "  release-cd       - An ISO9660 CD image." ;
57                                 Echo "  release-vmware   - A VMware disk image." ;
58                                 Echo ;
59                                 Echo "Bootstrap build profiles (minimal image used for"
60                         "initial build of HPKG packages):" ;
61                                 Echo "  bootstrap-raw    - A raw disk image." ;
62                                 Echo "  bootstrap-vmware - A VMware disk image." ;
63                                 Echo ;
64                                 Echo "Build profile actions:" ;
65                                 Echo "  build                - Build a Haiku"
66                                         "image/installation. This is the default" ;
67                                 Echo "                         action, i.e. it can be"
68                                         "omitted." ;
69                                 Echo "  update <target> ...  - Update the specified targets in"
70                                         "the Haiku" ;
71                                 Echo "                         image/installation." ;
72                                 Echo "  update-all           - Update all targets in the Haiku"
73                                         "image/installation." ;
74                                 Echo "  mount                - Mount the Haiku image in the"
75                                         " bfs_shell." ;
76                                 Echo ;
77                                 Echo "For more details on how to customize Haiku builds read" ;
78                                 Echo "build/jam/UserBuildConfig.ReadMe." ;
79                                 Exit ;
80                         }
82                         # The "run" target allows for running arbitrary command lines
83                         # containing build system targets, which are built and replaced
84                         # accordingly.
85                         case run : {
86                                 if $(JAM_TARGETS[2]) {
87                                         JAM_TARGETS = [ RunCommandLine $(JAM_TARGETS[2-]) ] ;
88                                 } else {
89                                         Exit "\"jam run\" requires parameters!" ;
90                                 }
91                         }
93                         # A target starting with "@" is a build profile.
94                         case @* : {
95                                 HAIKU_BUILD_PROFILE = [ Match "@(.*)" : $(JAM_TARGETS[1]) ] ;
96                                 HAIKU_BUILD_PROFILE_ACTION = $(JAM_TARGETS[2]:E=build) ;
97                                 HAIKU_BUILD_PROFILE_PARAMETERS = $(JAM_TARGETS[3-]) ;
98                                 HAIKU_BUILD_PROFILE_DEFINED = ;
99                         }
101                         case * : {
102                                 # "update-image", "update-vmware-image", and "update-install"
103                                 # targets allow for updating only specific targets in the
104                                 # image/installation dir.
105                                 if $(JAM_TARGETS[1]) in update-image update-vmware-image
106                                                 update-install {
107                                         SetUpdateHaikuImageOnly 1 ;
108                                         HAIKU_PACKAGES_UPDATE_ONLY = 1 ;
109                                         HAIKU_INCLUDE_IN_IMAGE on $(JAM_TARGETS[2-]) = 1 ;
110                                         HAIKU_INCLUDE_IN_PACKAGES on $(JAM_TARGETS[2-]) = 1 ;
112                                         if $(JAM_TARGETS[1]) = update-image {
113                                                 JAM_TARGETS = haiku-image ;
114                                         } else if $(JAM_TARGETS[1]) = update-vmware-image {
115                                                 JAM_TARGETS = haiku-vmware-image ;
116                                         } else {
117                                                 JAM_TARGETS = install-haiku ;
118                                         }
119                                 }
120                         }
121                 }
122         }