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 " disk - A partition or hard disk device." ; 39 Echo " install - A Haiku installation in a directory." ; 40 Echo ; 41 Echo "Build profile actions:" ; 42 Echo " build - Build a Haiku" 43 "image/installation. This is the default" ; 44 Echo " action, i.e. it can be" 45 "omitted." ; 46 Echo " update <target> ... - Update the specified targets in" 47 " the Haiku" ; 48 Echo " image/installation." ; 49 Echo " update-all - Update all targets in the Haiku" 50 "image/installation." ; 51 Echo " mount - Mount the Haiku image in the" 52 "bfs_shell." ; 53 Echo ; 54 Echo "For more details on how to customize Haiku builds read" ; 55 Echo "build/jam/UserBuildConfig.ReadMe." ; 56 Exit ; 57 } 58 59 # The "run" target allows for running arbitrary command lines 60 # containing build system targets, which are built and replaced 61 # accordingly. 62 case run : { 63 if $(JAM_TARGETS[2]) { 64 JAM_TARGETS = [ RunCommandLine $(JAM_TARGETS[2-]) ] ; 65 } else { 66 Exit "\"jam run\" requires parameters!" ; 67 } 68 } 69 70 # A target starting with "@" is a build profile. 71 case @* : { 72 HAIKU_BUILD_PROFILE = [ Match "@(.*)" : $(JAM_TARGETS[1]) ] ; 73 HAIKU_BUILD_PROFILE_ACTION = $(JAM_TARGETS[2]:E=build) ; 74 HAIKU_BUILD_PROFILE_PARAMETERS = $(JAM_TARGETS[3-]) ; 75 HAIKU_BUILD_PROFILE_DEFINED = ; 76 } 77 78 case * : { 79 # "update-image", "update-vmware-image", and "update-install" 80 # targets allow for updating only specific targets in the 81 # image/installation dir. 82 if $(JAM_TARGETS[1]) in update-image update-vmware-image 83 update-install { 84 SetUpdateHaikuImageOnly 1 ; 85 HAIKU_INCLUDE_IN_IMAGE on $(JAM_TARGETS[2-]) = 1 ; 86 87 if $(JAM_TARGETS[1]) = update-image { 88 JAM_TARGETS = haiku-image ; 89 } else if $(JAM_TARGETS[1]) = update-vmware-image { 90 JAM_TARGETS = haiku-vmware-image ; 91 } else { 92 JAM_TARGETS = install-haiku ; 93 } 94 } 95 } 96 } 97 } 98} 99