-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.include
85 lines (67 loc) · 4.98 KB
/
Makefile.include
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
VALID_CULTURES = ar bg ca zh-CHS cs da de el en es fi fr he hu is it ja ko nl no pl pt ro ru hr sk sq sv th tr id uk be sl et lv lt fa vi hy eu mk af fo hi sw gu ta te kn mr gl kok ar-SA bg-BG ca-ES zh-TW cs-CZ da-DK de-DE el-GR en-US fi-FI fr-FR he-IL hu-HU is-IS it-IT ja-JP ko-KR nl-NL nb-NO pl-PL pt-BR ro-RO ru-RU hr-HR sk-SK sq-AL sv-SE th-TH tr-TR id-ID uk-UA be-BY sl-SI et-EE lv-LV lt-LT fa-IR vi-VN hy-AM eu-ES mk-MK af-ZA fo-FO hi-IN sw-KE gu-IN ta-IN te-IN kn-IN mr-IN gl-ES kok-IN ar-IQ zh-CN de-CH en-GB es-MX fr-BE it-CH nl-BE nn-NO pt-PT sv-FI ar-EG zh-HK de-AT en-AU es-ES fr-CA ar-LY zh-SG de-LU en-CA es-GT fr-CH ar-DZ zh-MO en-NZ es-CR fr-LU ar-MA en-IE es-PA ar-TN en-ZA es-DO ar-OM es-VE ar-YE es-CO ar-SY es-PE ar-JO es-AR ar-LB en-ZW es-EC ar-KW en-PH es-CL ar-AE es-UY ar-BH es-PY ar-QA es-BO es-SV es-HN es-NI es-PR zh-CHT
build_sources = $(FILES) $(GENERATED_FILES)
build_sources_embed = $(build_sources:%='$(srcdir)/%')
comma__=,
get_resource_name = $(firstword $(subst $(comma__), ,$1))
get_culture = $(lastword $(subst ., ,$(basename $1)))
is_cultured_resource = $(and $(word 3,$(subst ., ,$1)), $(filter $(VALID_CULTURES),$(lastword $(subst ., ,$(basename $1)))))
build_resx_list = $(foreach res, $(RESOURCES), $(if $(filter %.resx, $(call get_resource_name,$(res))),$(res),))
build_non_culture_resx_list = $(foreach res, $(build_resx_list),$(if $(call is_cultured_resource,$(call get_resource_name,$(res))),,$(res)))
build_non_culture_others_list = $(foreach res, $(filter-out $(build_resx_list),$(RESOURCES)),$(if $(call is_cultured_resource,$(call get_resource_name,$(res))),,$(res)))
build_others_list = $(build_non_culture_others_list)
build_xamlg_list = $(filter %.xaml.g.cs, $(FILES))
# resgen all .resx resources
build_resx_files = $(foreach res, $(build_resx_list), $(call get_resource_name,$(res)))
build_resx_resources = $(build_resx_files:.resx=.resources)
# embed resources for the main assembly
build_resx_resources_hack = $(subst .resx,.resources, $(build_non_culture_resx_list))
build_resx_resources_embed = $(build_resx_resources_hack:%='-resource:%')
build_others_files = $(foreach res, $(build_others_list),$(call get_resource_name,$(res)))
build_others_resources = $(build_others_files)
build_others_resources_embed = $(build_others_list:%='-resource:$(srcdir)/%')
build_resources = $(build_resx_resources) $(build_others_resources)
build_resources_embed = $(build_resx_resources_embed) $(build_others_resources_embed)
build_references_ref = $(foreach ref, $(REFERENCES), $(if $(filter -pkg:%, $(ref)), $(ref), $(if $(filter -r:%, $(ref)), $(ref), -r:$(ref))))
build_references_ref += $(foreach ref, $(DLL_REFERENCES), -r:$(ref))
build_references_ref += $(foreach ref, $(PROJECT_REFERENCES), -r:$(ref))
EXTRA_DIST += $(build_sources) $(build_resx_files) $(build_others_files) $(ASSEMBLY_WRAPPER_IN) $(EXTRAS) $(DATA_FILES) $(build_culture_res_files)
CLEANFILES += $(ASSEMBLY) $(ASSEMBLY).mdb $(BINARIES) $(build_resx_resources) $(build_satellite_assembly_list)
DISTCLEANFILES = $(GENERATED_FILES) $(pc_files) $(BUILD_DIR)/*
pkglib_SCRIPTS = $(ASSEMBLY)
bin_SCRIPTS = $(BINARIES)
programfilesdir = @libdir@/@PACKAGE@
programfiles_DATA = $(PROGRAMFILES)
programfilesiconsdir = @libdir@/@PACKAGE@/icons
programfilesicons_DATA = $(PROGRAMFILES_ICONS)
linuxpkgconfigdir = @libdir@/pkgconfig
linuxpkgconfig_DATA = $(LINUX_PKGCONFIG)
linuxdesktopapplicationsdir = @prefix@/share/applications
linuxdesktopapplications_DATA = $(LINUX_DESKTOPAPPLICATIONS)
# macros
# $(call emit-deploy-target,deploy-variable-name)
define emit-deploy-target
$($1): $($1_SOURCE)
mkdir -p $$(dir $($1))
cp '$$<' '$$@'
endef
# $(call emit-deploy-wrapper,wrapper-variable-name,wrapper-sourcefile,x)
# assumes that for a wrapper foo.pc its source template is foo.pc.in
# if $3 is non-empty then wrapper is marked exec
define emit-deploy-wrapper
$($1): $2
mkdir -p '$$(@D)'
cp '$$<' '$$@'
$(if $3,chmod +x '$$@')
endef
# generating satellite assemblies
culture_resources = $(foreach res, $(RESOURCES), $(if $(call is_cultured_resource,$(call get_resource_name, $(res))),$(res)))
cultures = $(sort $(foreach res, $(culture_resources), $(call get_culture,$(call get_resource_name,$(res)))))
culture_resource_dependencies = $(BUILD_DIR)/$1/$(SATELLITE_ASSEMBLY_NAME): $(subst .resx,.resources,$2)
culture_resource_commandlines = cmd_line_satellite_$1 += '/embed:$(subst .resx,.resources,$2)'
build_satellite_assembly_list = $(cultures:%=$(BUILD_DIR)/%/$(SATELLITE_ASSEMBLY_NAME))
build_culture_res_files = $(foreach res, $(culture_resources),$(call get_resource_name,$(res)))
$(eval $(foreach res, $(culture_resources), $(eval $(call culture_resource_dependencies,$(call get_culture,$(call get_resource_name,$(res))),$(call get_resource_name,$(res))))))
$(eval $(foreach res, $(culture_resources), $(eval $(call culture_resource_commandlines,$(call get_culture,$(call get_resource_name,$(res))),$(res)))))
$(build_satellite_assembly_list): $(BUILD_DIR)/%/$(SATELLITE_ASSEMBLY_NAME):
mkdir -p '$(@D)'
$(AL) -out:'$@' -culture:$* -t:lib $(cmd_line_satellite_$*)