1# Rules related to processing of jam command line arguments. 2 3rule ProcessCommandLineArguments 4{ 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 } 18 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:" ; 34 Echo " image - A raw disk image." ; 35 Echo " anyboot-image - A custom image for either CD or disk." ; 36 Echo " cd-image - An ISO9660 CD image." ; 37 Echo " vmware-image - A VMware disk image." ; 38 Echo " install - A Haiku installation in a directory." ; 39 Echo ; 40 Echo "Build profile actions:" ; 41 Echo " build - Build a Haiku" 42 "image/installation. This is the default" ; 43 Echo " action, i.e. it can be" 44 "omitted." ; 45 Echo " update <target> ... - Update the specified targets in" 46 " the Haiku" ; 47 Echo " image/installation." ; 48 Echo " update-all - Update all targets in the Haiku" 49 "image/installation." ; 50 Echo " mount - Mount the Haiku image in the" 51 "bfs_shell." ; 52 Echo ; 53 Echo "For more details on how to customize Haiku builds read" ; 54 Echo "build/jam/UserBuildConfig.ReadMe." ; 55 Exit ; 56 } 57 58 # The "run" target allows for running arbitrary command lines 59 # containing build system targets, which are built and replaced 60 # accordingly. 61 case run : { 62 if $(JAM_TARGETS[2]) { 63 JAM_TARGETS = [ RunCommandLine $(JAM_TARGETS[2-]) ] ; 64 } else { 65 Exit "\"jam run\" requires parameters!" ; 66 } 67 } 68 69 # Copy the given set of local package files to the git repository 70 # server, where they will be used for creating a new repository 71 # during the push hook. 72 case upload-packages : { 73 UploadPackages $(JAM_TARGETS[1]) : $(JAM_TARGETS[2-]) ; 74 JAM_TARGETS = $(JAM_TARGETS[1]) ; 75 NotFile $(JAM_TARGETS) ; 76 Always $(JAM_TARGETS) ; 77 } 78 79 # A target starting with "@" is a build profile. 80 case @* : { 81 HAIKU_BUILD_PROFILE = [ Match "@(.*)" : $(JAM_TARGETS[1]) ] ; 82 HAIKU_BUILD_PROFILE_ACTION = $(JAM_TARGETS[2]:E=build) ; 83 HAIKU_BUILD_PROFILE_PARAMETERS = $(JAM_TARGETS[3-]) ; 84 HAIKU_BUILD_PROFILE_DEFINED = ; 85 } 86 87 case * : { 88 # "update-image", "update-vmware-image", and "update-install" 89 # targets allow for updating only specific targets in the 90 # image/installation dir. 91 if $(JAM_TARGETS[1]) in update-image update-vmware-image 92 update-install { 93 SetUpdateHaikuImageOnly 1 ; 94 HAIKU_PACKAGES_UPDATE_ONLY = 1 ; 95 HAIKU_INCLUDE_IN_IMAGE on $(JAM_TARGETS[2-]) = 1 ; 96 HAIKU_INCLUDE_IN_PACKAGES on $(JAM_TARGETS[2-]) = 1 ; 97 98 if $(JAM_TARGETS[1]) = update-image { 99 JAM_TARGETS = haiku-image ; 100 } else if $(JAM_TARGETS[1]) = update-vmware-image { 101 JAM_TARGETS = haiku-vmware-image ; 102 } else { 103 JAM_TARGETS = install-haiku ; 104 } 105 } 106 } 107 } 108 } 109} 110