Hi,
I'd like to propose removing gbuild_simple.mk over time.
Surely there will be more custom targets as gbuild is growing and I
can't see why we would need gbuild_simple.
Instead we can write rules to Package_foo.mk makefiles or if that
would be problem (because they will be ugly)
We can start using CutomTarget_foo.mk which will be supposed to be ugly.
The reasons are:
1, Sometimes we need to parse custom target's Makefile each time as in
packimages case.
I had to use:
$(eval $(call gb_CustomTarget_add_outdir_dependencies,packimages/pack,\
$(gb_Helper_PHONY) \
))
to achieve that.
2, It is enough then to write dependencies only once.
3, No need to maintain gbuild_simple.
4, No recursive make running.
I am sending two patches for packimages.
Maybe we should use the second one and keep Package_foo.mk pretty ?
One small disadvantage is that we need to depend on directory.
It allows as to use compatible mode and keep old way of processing
custom targets until they are replaced.
There are 31 custom targets now, so that should not be a big problem.
I can do it over time or maybe we could even write an easy hack for that.
The important thing is to write new custom targets in
CustomTarget_foo.mk makefile.
What do you think ? Am I missing something ?
Regards,
Matus
From 938249e500ea108a07c42df95122d6826df594fb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mat=C3=BA=C5=A1=20Kukan?= <matus.kukan@gmail.com>
Date: Fri, 16 Mar 2012 13:10:12 +0100
Subject: [PATCH] packimages: do not use custom Makefile
---
packimages/Package_images.mk | 51 ++++++++++++++++++++++++++----
packimages/pack/Makefile | 70 ------------------------------------------
2 files changed, 44 insertions(+), 77 deletions(-)
delete mode 100644 packimages/pack/Makefile
diff --git a/packimages/Package_images.mk b/packimages/Package_images.mk
index 21be311..6a72d96 100644
--- a/packimages/Package_images.mk
+++ b/packimages/Package_images.mk
@@ -25,17 +25,54 @@
# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
# instead of those above.
-$(eval $(call gb_Package_Package,packimages_images,$(WORKDIR)/CustomTarget/packimages/pack))
+CDPI := $(WORKDIR)/CustomTarget/packimages
-$(eval $(call gb_Package_add_customtarget,packimages_images,packimages/pack))
-
-$(eval $(call gb_CustomTarget_add_outdir_dependencies,packimages/pack,\
- $(gb_Helper_PHONY) \
-))
+$(eval $(call gb_Package_Package,packimages_images,$(CDPI)))
$(eval $(call gb_Package_add_file,packimages_images,bin/images.zip,images.zip))
+$(eval $(call gb_Package_add_file,packimages_images,bin/images_brand.zip,images_brand.zip))
-$(foreach theme,$(WITH_THEMES) brand,\
+$(foreach theme,$(WITH_THEMES),\
$(eval $(call gb_Package_add_file,packimages_images,bin/images_$(theme).zip,images_$(theme).zip)))
+# Custom sets, at 24x24 & 16x16 fall-back to Tango preferentially
+# (Tango fallbacks to Industrial for the missing icons)
+CUSTOM_images := $(foreach theme,$(WITH_THEMES),$(CDPI)/images_$(theme).zip)
+CUSTOM_PREFERRED_FALLBACK_1 := -c $(SRCDIR)/icon-themes/tango
+CUSTOM_PREFERRED_FALLBACK_2 := -c $(SRCDIR)/icon-themes/industrial
+
+$(call gb_Package_get_target,packimages_images): \
+ $(CDPI)/images.zip $(CDPI)/images_brand.zip $(CUSTOM_images)
+
+$(CDPI)/images.zip: $(CDPI)/sorted.lst $(CDPI)/commandimagelist.ilst
+ $(call gb_Helper_abbreviate_dirs_native, \
+ $(PERL) $(SOLARENV)/bin/packimages.pl -g $(SRCDIR)/icon-themes/galaxy \
+ -m $(SRCDIR)/icon-themes/galaxy -c $(CDPI) \
+ -l $(CDPI) -l $(OUTDIR)/res/img -s $< -o $@)
+
+$(CDPI)/images_%.zip: $(CDPI)/sorted.lst $(CDPI)/commandimagelist.ilst
+ $(call gb_Helper_abbreviate_dirs_native, \
+ $(PERL) $(SOLARENV)/bin/packimages.pl -g $(SRCDIR)/icon-themes/galaxy \
+ -m $(SRCDIR)/icon-themes/galaxy -c $(SRCDIR)/icon-themes/$* \
+ $(CUSTOM_PREFERRED_FALLBACK_1) $(CUSTOM_PREFERRED_FALLBACK_2) \
+ -l $(CDPI) -l $(OUTDIR)/res/img -s $< -o $@)
+
+# make sure to have one to keep packing happy
+$(CDPI)/images_brand.zip:
+ @touch $@
+
+# commandimagelist.ilst and sorted.lst are phony to rebuild everything each time
+.PHONY: $(CDPI)/commandimagelist.ilst $(CDPI)/sorted.lst
+
+$(CDPI)/commandimagelist.ilst:
+ $(call gb_Helper_abbreviate_dirs_native, \
+ find $(SRCDIR)/icon-themes/galaxy/cmd -name "*.png" | \
+ sed "s#$(SRCDIR)/icon-themes/galaxy#%MODULE%#" | \
+ $(PERL) $(SOLARENV)/bin/sort.pl > $@.$(INPATH) && \
+ $(PERL) $(SOLARENV)/bin/diffmv.pl $@.$(INPATH) $@)
+
+$(CDPI)/sorted.lst: $(SRCDIR)/packimages/pack/image-sort.lst
+ $(call gb_Helper_abbreviate_dirs_native, \
+ $(PERL) $(SOLARENV)/bin/image-sort.pl $< $(OUTDIR)/xml $@)
+
# vim: set noet sw=4 ts=4:
diff --git a/packimages/pack/Makefile b/packimages/pack/Makefile
deleted file mode 100644
index 5d88e25..0000000
--- a/packimages/pack/Makefile
+++ /dev/null
@@ -1,70 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#
-# Version: MPL 1.1 / GPLv3+ / LGPLv3+
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License or as specified alternatively below. You may obtain a copy of
-# the License at http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# Major Contributor(s):
-# Copyright (C) 2012 Matúš Kukan <matus.kukan@gmail.com> (initial developer)
-#
-# All Rights Reserved.
-#
-# For minor contributions see the git repository.
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
-# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
-# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
-# instead of those above.
-
-gb_PARTIALBUILD:=T
-include $(GBUILDDIR)/gbuild_simple.mk
-
-# Custom sets, at 24x24 & 16x16 fall-back to Tango preferentially
-# (Tango fallbacks to Industrial for the missing icons)
-CUSTOM_images := $(foreach theme,$(WITH_THEMES),images_$(theme).zip)
-CUSTOM_PREFERRED_FALLBACK_1 := -c $(SRCDIR)/icon-themes/tango
-CUSTOM_PREFERRED_FALLBACK_2 := -c $(SRCDIR)/icon-themes/industrial
-
-# commandimagelist.ilst and sorted.lst are phony to rebuild everything each time
-.PHONY: all commandimagelist.ilst sorted.lst
-all: images.zip images_brand.zip $(CUSTOM_images)
-
-images.zip: commandimagelist.ilst sorted.lst
- $(call gb_Helper_abbreviate_dirs_native, \
- $(PERL) $(SOLARENV)/bin/packimages.pl -g $(SRCDIR)/icon-themes/galaxy \
- -m $(SRCDIR)/icon-themes/galaxy -c . -l . -l $(OUTDIR)/res/img \
- -s sorted.lst -o $@)
-
-images_%.zip: commandimagelist.ilst sorted.lst
- $(call gb_Helper_abbreviate_dirs_native, \
- $(PERL) $(SOLARENV)/bin/packimages.pl -g $(SRCDIR)/icon-themes/galaxy \
- -m $(SRCDIR)/icon-themes/galaxy -c $(SRCDIR)/icon-themes/$* \
- $(CUSTOM_PREFERRED_FALLBACK_1) $(CUSTOM_PREFERRED_FALLBACK_2) \
- -l . -l $(OUTDIR)/res/img -s sorted.lst -o $@)
-
-# make sure to have one to keep packing happy
-images_brand.zip:
- @touch $@
-
-commandimagelist.ilst:
- $(call gb_Helper_abbreviate_dirs_native, \
- find $(SRCDIR)/icon-themes/galaxy/cmd -name "*.png" | \
- sed "s#$(SRCDIR)/icon-themes/galaxy#%MODULE%#" | \
- $(PERL) $(SOLARENV)/bin/sort.pl > $@.$(INPATH) && \
- $(PERL) $(SOLARENV)/bin/diffmv.pl $@.$(INPATH) $@)
-
-sorted.lst: $(SRCDIR)/packimages/pack/image-sort.lst
- $(call gb_Helper_abbreviate_dirs_native, \
- $(PERL) $(SOLARENV)/bin/image-sort.pl $< $(OUTDIR)/xml $@)
-
-.DEFAULT_GOAL := all
-# vim: set noet sw=4 ts=4:
--
1.7.1
From 137a8e37147c6e95f059e3993f2575202527a034 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mat=C3=BA=C5=A1=20Kukan?= <matus.kukan@gmail.com>
Date: Fri, 16 Mar 2012 15:37:49 +0100
Subject: [PATCH] packimages: do not use custom Makefile
---
packimages/CustomTarget_images.mk | 72 +++++++++++++++++++++++++++++++++++++
packimages/Module_packimages.mk | 1 +
packimages/Package_images.mk | 11 ++----
packimages/pack/Makefile | 70 -----------------------------------
solenv/gbuild/CustomTarget.mk | 11 +++++-
5 files changed, 86 insertions(+), 79 deletions(-)
create mode 100644 packimages/CustomTarget_images.mk
delete mode 100644 packimages/pack/Makefile
diff --git a/packimages/CustomTarget_images.mk b/packimages/CustomTarget_images.mk
new file mode 100644
index 0000000..468d2fd
--- /dev/null
+++ b/packimages/CustomTarget_images.mk
@@ -0,0 +1,72 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# Version: MPL 1.1 / GPLv3+ / LGPLv3+
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License or as specified alternatively below. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# Major Contributor(s):
+# Copyright (C) 2012 Matúš Kukan <matus.kukan@gmail.com> (initial developer)
+#
+# All Rights Reserved.
+#
+# For minor contributions see the git repository.
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+# instead of those above.
+
+$(eval $(call gb_CustomTarget_CustomTarget,packimages/images,new_style))
+
+CDPI := $(call gb_CustomTarget_get_workdir,packimages/images)
+
+# Custom sets, at 24x24 & 16x16 fall-back to Tango preferentially
+# (Tango fallbacks to Industrial for the missing icons)
+CUSTOM_images := $(foreach theme,$(WITH_THEMES),$(CDPI)/images_$(theme).zip)
+CUSTOM_PREFERRED_FALLBACK_1 := -c $(SRCDIR)/icon-themes/tango
+CUSTOM_PREFERRED_FALLBACK_2 := -c $(SRCDIR)/icon-themes/industrial
+
+$(call gb_CustomTarget_get_target,packimages/images) : \
+ $(CDPI)/images.zip $(CDPI)/images_brand.zip $(CUSTOM_images)
+
+$(CDPI)/images.zip : $(CDPI)/sorted.lst $(CDPI)/commandimagelist.ilst
+ $(call gb_Helper_abbreviate_dirs_native, \
+ $(PERL) $(SOLARENV)/bin/packimages.pl -g $(SRCDIR)/icon-themes/galaxy \
+ -m $(SRCDIR)/icon-themes/galaxy -c $(CDPI) \
+ -l $(CDPI) -l $(OUTDIR)/res/img -s $< -o $@)
+
+$(CDPI)/images_%.zip : $(CDPI)/sorted.lst $(CDPI)/commandimagelist.ilst
+ $(call gb_Helper_abbreviate_dirs_native, \
+ $(PERL) $(SOLARENV)/bin/packimages.pl -g $(SRCDIR)/icon-themes/galaxy \
+ -m $(SRCDIR)/icon-themes/galaxy -c $(SRCDIR)/icon-themes/$* \
+ $(CUSTOM_PREFERRED_FALLBACK_1) $(CUSTOM_PREFERRED_FALLBACK_2) \
+ -l $(CDPI) -l $(OUTDIR)/res/img -s $< -o $@)
+
+# make sure to have one to keep packing happy
+$(CDPI)/images_brand.zip :
+ @touch $@
+
+# commandimagelist.ilst and sorted.lst are phony to rebuild everything each time
+.PHONY : $(CDPI)/commandimagelist.ilst $(CDPI)/sorted.lst
+
+$(CDPI)/commandimagelist.ilst :| $(CDPI)/.dir
+ $(call gb_Helper_abbreviate_dirs_native, \
+ find $(SRCDIR)/icon-themes/galaxy/cmd -name "*.png" | \
+ sed "s#$(SRCDIR)/icon-themes/galaxy#%MODULE%#" | \
+ $(PERL) $(SOLARENV)/bin/sort.pl > $@.$(INPATH) && \
+ $(PERL) $(SOLARENV)/bin/diffmv.pl $@.$(INPATH) $@)
+
+$(CDPI)/sorted.lst : $(SRCDIR)/packimages/pack/image-sort.lst | $(CDPI)/.dir
+ $(call gb_Helper_abbreviate_dirs_native, \
+ $(PERL) $(SOLARENV)/bin/image-sort.pl $< $(OUTDIR)/xml $@)
+
+# vim: set noet sw=4 ts=4:
diff --git a/packimages/Module_packimages.mk b/packimages/Module_packimages.mk
index eca8c69..ec424c4 100644
--- a/packimages/Module_packimages.mk
+++ b/packimages/Module_packimages.mk
@@ -28,6 +28,7 @@
$(eval $(call gb_Module_Module,packimages))
$(eval $(call gb_Module_add_targets,packimages,\
+ CustomTarget_images \
Package_images \
))
diff --git a/packimages/Package_images.mk b/packimages/Package_images.mk
index 21be311..eb56980 100644
--- a/packimages/Package_images.mk
+++ b/packimages/Package_images.mk
@@ -25,17 +25,12 @@
# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
# instead of those above.
-$(eval $(call gb_Package_Package,packimages_images,$(WORKDIR)/CustomTarget/packimages/pack))
-
-$(eval $(call gb_Package_add_customtarget,packimages_images,packimages/pack))
-
-$(eval $(call gb_CustomTarget_add_outdir_dependencies,packimages/pack,\
- $(gb_Helper_PHONY) \
-))
+$(eval $(call gb_Package_Package,packimages_images,$(call gb_CustomTarget_get_workdir,packimages)))
$(eval $(call gb_Package_add_file,packimages_images,bin/images.zip,images.zip))
+$(eval $(call gb_Package_add_file,packimages_images,bin/images_brand.zip,images_brand.zip))
-$(foreach theme,$(WITH_THEMES) brand,\
+$(foreach theme,$(WITH_THEMES),\
$(eval $(call gb_Package_add_file,packimages_images,bin/images_$(theme).zip,images_$(theme).zip)))
# vim: set noet sw=4 ts=4:
diff --git a/packimages/pack/Makefile b/packimages/pack/Makefile
deleted file mode 100644
index 5d88e25..0000000
--- a/packimages/pack/Makefile
+++ /dev/null
@@ -1,70 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#
-# Version: MPL 1.1 / GPLv3+ / LGPLv3+
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License or as specified alternatively below. You may obtain a copy of
-# the License at http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# Major Contributor(s):
-# Copyright (C) 2012 Matúš Kukan <matus.kukan@gmail.com> (initial developer)
-#
-# All Rights Reserved.
-#
-# For minor contributions see the git repository.
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
-# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
-# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
-# instead of those above.
-
-gb_PARTIALBUILD:=T
-include $(GBUILDDIR)/gbuild_simple.mk
-
-# Custom sets, at 24x24 & 16x16 fall-back to Tango preferentially
-# (Tango fallbacks to Industrial for the missing icons)
-CUSTOM_images := $(foreach theme,$(WITH_THEMES),images_$(theme).zip)
-CUSTOM_PREFERRED_FALLBACK_1 := -c $(SRCDIR)/icon-themes/tango
-CUSTOM_PREFERRED_FALLBACK_2 := -c $(SRCDIR)/icon-themes/industrial
-
-# commandimagelist.ilst and sorted.lst are phony to rebuild everything each time
-.PHONY: all commandimagelist.ilst sorted.lst
-all: images.zip images_brand.zip $(CUSTOM_images)
-
-images.zip: commandimagelist.ilst sorted.lst
- $(call gb_Helper_abbreviate_dirs_native, \
- $(PERL) $(SOLARENV)/bin/packimages.pl -g $(SRCDIR)/icon-themes/galaxy \
- -m $(SRCDIR)/icon-themes/galaxy -c . -l . -l $(OUTDIR)/res/img \
- -s sorted.lst -o $@)
-
-images_%.zip: commandimagelist.ilst sorted.lst
- $(call gb_Helper_abbreviate_dirs_native, \
- $(PERL) $(SOLARENV)/bin/packimages.pl -g $(SRCDIR)/icon-themes/galaxy \
- -m $(SRCDIR)/icon-themes/galaxy -c $(SRCDIR)/icon-themes/$* \
- $(CUSTOM_PREFERRED_FALLBACK_1) $(CUSTOM_PREFERRED_FALLBACK_2) \
- -l . -l $(OUTDIR)/res/img -s sorted.lst -o $@)
-
-# make sure to have one to keep packing happy
-images_brand.zip:
- @touch $@
-
-commandimagelist.ilst:
- $(call gb_Helper_abbreviate_dirs_native, \
- find $(SRCDIR)/icon-themes/galaxy/cmd -name "*.png" | \
- sed "s#$(SRCDIR)/icon-themes/galaxy#%MODULE%#" | \
- $(PERL) $(SOLARENV)/bin/sort.pl > $@.$(INPATH) && \
- $(PERL) $(SOLARENV)/bin/diffmv.pl $@.$(INPATH) $@)
-
-sorted.lst: $(SRCDIR)/packimages/pack/image-sort.lst
- $(call gb_Helper_abbreviate_dirs_native, \
- $(PERL) $(SOLARENV)/bin/image-sort.pl $< $(OUTDIR)/xml $@)
-
-.DEFAULT_GOAL := all
-# vim: set noet sw=4 ts=4:
diff --git a/solenv/gbuild/CustomTarget.mk b/solenv/gbuild/CustomTarget.mk
index bcb4874..152ec33 100644
--- a/solenv/gbuild/CustomTarget.mk
+++ b/solenv/gbuild/CustomTarget.mk
@@ -37,9 +37,13 @@ define gb_CustomTarget__command
endef
+$(call gb_CustomTarget_get_workdir,%)/.dir :
+ $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
+
$(call gb_CustomTarget_get_target,%) :
$(call gb_Output_announce,$*,$(true),MAK,3)
- $(call gb_CustomTarget__command,$@,$*)
+ $(if $(NEW_STYLE),touch $@,\
+ $(call gb_CustomTarget__command,$@,$*))
.PHONY: $(call gb_CustomTarget_get_clean_target,%)
$(call gb_CustomTarget_get_clean_target,%) :
@@ -53,8 +57,13 @@ $(SRCDIR)/$(1)/Makefile
endef
define gb_CustomTarget_CustomTarget
+$(call gb_CustomTarget_get_target,$(1)) : NEW_STYLE := $(2)
+ifeq ($(2),)
$(call gb_CustomTarget_get_target,$(1)) : \
$(call gb_CustomTarget__get_makefile,$(1))
+else
+$$(eval $$(call gb_Module_register_target,$(call gb_CustomTarget_get_target,$(1)),$(call
gb_CustomTarget_get_clean_target,$(1))))
+endif
endef
--
1.7.1
Context
- [GBUILD] Can we get rid of gbuild_simple ? · Matúš Kukan
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.