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 # Adds a single resource to the resources of an executable/library. 45 # <target>: The executable/library. 46 # <resourceID>: A resource ID string as understood by xres (type:id[:name]). 47 # <dataFile>: The data to be written into the resource will be read from 48 # that file. 49 # 50 local target = $(1) ; 51 local resourceID = $(2) ; 52 local dataFile = $(3) ; 53 54 # the resource file 55 local resources 56 = <added-resources>file-data-$(resourceID)-$(dataFile).rsrc ; 57 58 # add it to the resources of the given target 59 AddResources $(target) : $(resources) ; 60 61 # if the rule for creating the resource file has not been invoked yet, do it 62 if ! [ on $(resources) return $(RESOURCES_DEFINED) ] { 63 RESOURCES_DEFINED on $(resources) = true ; 64 RESOURCE_ID on $(resources) = $(resourceID) ; 65 MakeLocateArch $(resources) ; 66 67 Depends $(resources) : <build>xres $(dataFile) ; 68 AddFileDataResource1 $(resources) : <build>xres $(dataFile) ; 69 } 70} 71 72actions AddFileDataResource1 73{ 74 $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) 75 $(2[1]) -o "$(1)" -a "$(RESOURCE_ID)" "$(2[2])" ; 76} 77 78rule XRes 79{ 80 # XRes <target> : <resource files> 81 if $(2) 82 { 83 Depends $(1) : <build>xres $(2) ; 84 XRes1 $(1) : <build>xres $(2) ; 85 } 86} 87 88actions XRes1 89{ 90 $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) 91 $(2[1]) -o "$(1)" "$(2[2-])" ; 92} 93 94rule SetVersion 95{ 96 # SetVersion <target> 97 98 Depends $(1) : <build>setversion ; 99 SetVersion1 $(1) : <build>setversion ; 100} 101 102actions SetVersion1 103{ 104 $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) 105 $(2[1]) "$(1)" -system $(HAIKU_BUILD_VERSION) -short "$(HAIKU_BUILD_DESCRIPTION)" ; 106} 107 108rule SetType 109{ 110 # SetType <target> 111 112 Depends $(1) : <build>settype ; 113 SetType1 $(1) : <build>settype ; 114} 115 116actions SetType1 117{ 118 $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) 119 $(2[1]) -t $(TARGET_EXECUTABLE_MIME_TYPE) "$(1)" ; 120} 121 122rule MimeSet 123{ 124 # MimeSet <target> 125 126 Depends $(1) : <build>mimeset ; 127 MimeSet1 $(1) : <build>mimeset ; 128} 129 130actions MimeSet1 131{ 132 $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) 133 $(2[1]) -f "$(1)" ; 134} 135 136rule ResComp 137{ 138 # ResComp <resource file> : <rdef file> ; 139 # 140 # <resource file> and <rdef file> must be gristed. 141 142 SEARCH on $(2) += $(SEARCH_SOURCE) ; 143 MakeLocateArch $(1) ; 144 Depends $(1) : $(2) <build>rc ; 145 LocalClean clean : $(1) ; 146 ResComp1 $(1) : <build>rc $(2) ; 147} 148 149actions ResComp1 150{ 151 $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) 152 $(2[1]) --auto-names -o $(1) $(2[2-]) 153} 154 155