1# BeOS specific rules 2 3 4rule AddStringDataResource 5{ 6 # AddStringDataResource <target> : <resourceID> : <dataString> 7 # Adds a single resource to the resources of an executable/library. 8 # <target>: The executable/library. 9 # <resourceID>: A resource ID string as understood by xres (type:id[:name]). 10 # <dataString>: The string <dataString> will be written to the resource. 11 # Defaults to "". 12 # 13 local target = $(1) ; 14 local resourceID = $(2) ; 15 local dataString = $(3:E="") ; 16 17 # the resource file 18 local resources 19 = [ FGristFiles $(target:B)-added-string-data-resources.rsrc ] ; 20 21 # add the resource file to the target, if not yet done 22 if ! [ on $(resources) return $(RESOURCES_ADDED) ] { 23 RESOURCES_ADDED on $(resources) = true ; 24 MakeLocateArch $(resources) ; 25 Depends $(resources) : <build>xres ; 26 AddStringDataResource1 $(resources) : <build>xres ; 27 AddResources $(target) : $(resources) ; 28 } 29 30 RESOURCE_STRINGS on $(resources) 31 += "-a "$(resourceID)" -s \""$(dataString)"\"" ; 32} 33 34actions together AddStringDataResource1 35{ 36 $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) 37 $(2[1]) -o "$(1)" $(RESOURCE_STRINGS) 38} 39 40 41rule AddFileDataResource 42{ 43 # AddFileDataResource <target> : <resourceID> : [ <dataFile> ] 44 # : [ <dataString> ] 45 # Adds a single resource to the resources of an executable/library. 46 # <target>: The executable/library. 47 # <resourceID>: A resource ID string as understood by xres (type:id[:name]). 48 # <dataFile>: The data to be written into the resource will be read from 49 # that file. 50 # 51 local target = $(1) ; 52 local resourceID = $(2) ; 53 local dataFile = $(3) ; 54 55 # the resource file 56 local resources 57 = <added-resources>file-data-$(resourceID)-$(dataFile).rsrc ; 58 59 # add it to the resources of the given target 60 AddResources $(target) : $(resources) ; 61 62 # if the rule for creating the resource file has not been invoked yet, do it 63 if ! [ on $(resources) return $(RESOURCES_DEFINED) ] { 64 RESOURCES_DEFINED on $(resources) = true ; 65 RESOURCE_ID on $(resources) = $(resourceID) ; 66 MakeLocateArch $(resources) ; 67 68 Depends $(resources) : <build>xres $(dataFile) ; 69 AddFileDataResource1 $(resources) : <build>xres $(dataFile) ; 70 } 71} 72 73actions AddFileDataResource1 74{ 75 $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) 76 $(2[1]) -o "$(1)" -a "$(RESOURCE_ID)" "$(2[2])" ; 77} 78 79rule XRes 80{ 81 # XRes <target> : <resource files> 82 if $(2) 83 { 84 Depends $(1) : <build>xres $(2) ; 85 XRes1 $(1) : <build>xres $(2) ; 86 } 87} 88 89actions XRes1 90{ 91 $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) 92 $(2[1]) -o "$(1)" "$(2[2-])" ; 93} 94 95rule SetVersion 96{ 97 # SetVersion <target> 98 99 Depends $(1) : <build>setversion ; 100 SetVersion1 $(1) : <build>setversion ; 101} 102 103actions SetVersion1 104{ 105 $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) 106 $(2[1]) "$(1)" -system $(HAIKU_BUILD_VERSION) -short "$(HAIKU_BUILD_DESCRIPTION)" ; 107} 108 109rule SetType 110{ 111 # SetType <target> 112 113 Depends $(1) : <build>settype ; 114 SetType1 $(1) : <build>settype ; 115} 116 117actions SetType1 118{ 119 $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) 120 $(2[1]) -t $(TARGET_EXECUTABLE_MIME_TYPE) "$(1)" ; 121} 122 123rule MimeSet 124{ 125 # MimeSet <target> 126} 127 128rule ResComp 129{ 130 # ResComp <resource file> : <rdef file> ; 131 # 132 # <resource file> and <rdef file> must be gristed. 133 134 SEARCH on $(2) += $(SEARCH_SOURCE) ; 135 MakeLocateArch $(1) ; 136 Depends $(1) : $(2) <build>rc ; 137 LocalClean clean : $(1) ; 138 ResComp1 $(1) : <build>rc $(2) ; 139} 140 141actions ResComp1 142{ 143 $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) 144 $(2[1]) --auto-names -o $(1) $(2[2-]) 145} 146 147 148if $(OS) = BEOS 149{ 150 151actions MimeSet 152{ 153 mimeset -f "$(1)" ; 154} 155 156} # if BEOS 157 158