1 SubDir HAIKU_TOP src data mime_db ;
4 rule BuildMimeDB superTypes
6 local mimeDB = <mimedb>mime_db ;
7 MakeLocateCommonPlatform $(mimeDB) ;
10 local compiledSuperTypes ;
12 for superType in $(superTypes) {
13 local compiledSuperType = $(superType:S=.rsrc:G=mimedb-super) ;
14 ResComp $(compiledSuperType) : $(superType) ;
15 compiledSuperTypes += $(compiledSuperType) ;
18 Depends $(mimeDB) : <build>resattr $(compiledSuperTypes) ;
19 BuildMimeDBSuperTypes $(mimeDB) : <build>resattr $(compiledSuperTypes) ;
21 # make the subtypes for each supertype
22 for superType in $(superTypes) {
23 local subTypes = [ on $(superType) return $(HAIKU_MIMEDB_SUBTYPES) ] ;
24 local compiledSubTypes ;
25 for subType in $(subTypes) {
26 local compiledSubType = $(subType:BS).rsrc ;
27 # Note: The subtype name may contain '.'s. Hence we cannot use
29 compiledSubType = $(compiledSubType:G=mimedb-sub-$(superType:B)) ;
30 MakeLocate $(compiledSubType)
31 : [ FDirName $(COMMON_PLATFORM_LOCATE_TARGET) $(superType:B) ] ;
32 # Need to locate explicitly to avoid clashes between equally
33 # named subtypes of different supertypes.
34 ResComp $(compiledSubType) : $(subType) ;
35 compiledSubTypes += $(compiledSubType) ;
38 if $(compiledSubTypes) {
39 Depends $(mimeDB) : $(superType) $(compiledSubTypes) ;
40 BuildMimeDBSubTypes $(mimeDB)
41 : <build>resattr $(superType) $(compiledSubTypes) ;
47 actions BuildMimeDBSuperTypes
49 $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
51 # remove and re-create the directory
53 $(RM) -rf "$baseDirectory"
54 mkdir "$baseDirectory"
58 for sourceFile in "$(2[2-])" ; do
59 type=`basename "$sourceFile" .rsrc`
60 targetDirectory="$baseDirectory/$type"
61 mkdir "$targetDirectory"
62 "$resattr" -O -o "$targetDirectory" "$sourceFile"
67 actions BuildMimeDBSubTypes
69 $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
72 superType=`basename "$(2[2])" .super`
73 superTypeDirectory="$(1)/$superType"
75 for sourceFile in "$(2[3-])" ; do
76 type=`basename "$sourceFile" .rsrc`
77 targetFile="$superTypeDirectory/$type"
78 "$resattr" -O -o "$targetFile" "$sourceFile"
83 # glob the supertype source files
84 local superTypeFiles = [ Glob $(SUBDIR) : *.super ] ;
85 superTypeFiles = $(superTypeFiles:BSG=mimedb) ;
86 SEARCH on $(superTypeFiles) = $(SUBDIR) ;
88 # for each supertype glob the subtype source files
90 for superTypeFile in $(superTypeFiles) {
91 local superTypeDirectory = [ FDirName $(SUBDIR) $(superTypeFile:B) ] ;
92 local subTypeFiles = [ Glob $(superTypeDirectory) : * ] ;
96 for subType in $(subTypeFiles:BS) {
97 if $(subType) != "." && $(subType) != ".." {
98 subType = $(subType:G=mimedb-sub-$(superTypeFile:B)) ;
99 SEARCH on $(subType) = $(superTypeDirectory) ;
100 subTypes += $(subType) ;
104 HAIKU_MIMEDB_SUBTYPES on $(superTypeFile) = $(subTypes) ;
107 BuildMimeDB $(superTypeFiles) ;