Fixed mingw build

This commit is contained in:
Yevgen Muntyan 2009-04-19 02:33:05 -07:00
parent 6373484f7d
commit 2cda7683e5
34 changed files with 1370 additions and 2083 deletions

View File

@ -1,9 +1,7 @@
syntax: glob
.git/
build/
autom4te.cache/
*-old
*-old.c
*.orig
@ -31,11 +29,14 @@ ltmain.sh
missing
mkinstalldirs
m4/ugly-stamp.m4
syntax: regexp
^po(-gsv)?/(Makefile\.in\.in|dist|missing|notexist|pot|intltool-update)$
Makefile\.am
^moo/mooapp/mooapp-credits\.h
^moo/mooutils/stock-(moo|medit)\.h
glob:*.tmp
glob:m4/libtool.m4
glob:m4/lt~obsolete.m4
glob:m4/ltsugar.m4
glob:m4/ltversion.m4
glob:m4/ltoptions.m4

1
TODO Normal file
View File

@ -0,0 +1 @@
get new ac_python_devel

View File

@ -38,6 +38,10 @@ Please check your Python installation.])
PYTHON_INCLUDES=$python_path
fi
if test x$MOO_OS_MINGW = xyes; then
PYTHON_INCLUDES=`echo "$PYTHON_INCLUDES" | sed 's%\\\\%/%g'`
fi
AC_MSG_RESULT([$PYTHON_INCLUDES])
AC_SUBST([PYTHON_INCLUDES])
fi
@ -62,10 +66,21 @@ Please check your Python installation.])
fi
fi
PYTHON_LIBS=`$PYTHON -c "from distutils.sysconfig import *; \
from string import join; \
print '-L' + PREFIX + '/lib', \
'-lpython';"`$py_version
if test x$MOO_OS_MINGW = xyes; then
PYTHON_LIBS=`$PYTHON -c "from distutils.sysconfig import *; \
from string import join; \
print '-L' + PREFIX + '/libs', \
'-lpython';"`$py_version
else
PYTHON_LIBS=`$PYTHON -c "from distutils.sysconfig import *; \
from string import join; \
print '-L' + PREFIX + '/lib', \
'-lpython';"`$py_version
fi
fi
if test x$MOO_OS_MINGW = xyes; then
PYTHON_LIBS=`echo "$PYTHON_LIBS" | sed 's%\\\\%/%g'`
fi
AC_MSG_RESULT([$PYTHON_LIBS])
@ -79,10 +94,15 @@ Please check your Python installation.])
if test "x$PYTHON_EXTRA_LIBS" = "x"; then
PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \
conf = distutils.sysconfig.get_config_var; \
print conf('LOCALMODLIBS'), conf('LIBS')"`
print conf('LOCALMODLIBS') or '', conf('LIBS') or ''"`
PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \
conf = distutils.sysconfig.get_config_var; \
print conf('LDFLAGS')"`
print conf('LDFLAGS') or ''"`
fi
if test x$MOO_OS_MINGW = xyes; then
PYTHON_EXTRA_LIBS=`echo "$PYTHON_EXTRA_LIBS" | sed 's%\\\\%/%g'`
PYTHON_EXTRA_LDFLAGS=`echo "$PYTHON_EXTRA_LDFLAGS" | sed 's%\\\\%/%g'`
fi
AC_MSG_CHECKING([Python extra libs])
@ -106,25 +126,25 @@ Please check your Python installation.])
# checks python stuff when building for unix
#
AC_DEFUN([_MOO_AC_CHECK_PYTHON_UNIX],[
AM_PATH_PYTHON([$1],[
_MOO_AC_PYTHON_DEVEL([
python_found=yes
],[
AC_MSG_WARN([Found python interpreter but no development headers or libraries])
python_found=no
])
AM_PATH_PYTHON([$1],[
_MOO_AC_PYTHON_DEVEL([
_moo_python_found=yes
],[
python_found=no
AC_MSG_WARN([Found python interpreter but no development headers or libraries])
python_found=no
])
],[
AC_MSG_ERROR([Python interpreter not found but it is required to build medit])
])
if test x$python_found = xyes; then
m4_if([$2],[],[:],[$2])
else
PYTHON_INCLUDES=""
PYTHON_LIBS=""
PYTHON_EXTRA_LIBS=""
m4_if([$3],[],[:],[$3])
fi
if test x$python_found = xyes; then
m4_if([$2],[],[:],[$2])
else
PYTHON_INCLUDES=""
PYTHON_LIBS=""
PYTHON_EXTRA_LIBS=""
m4_if([$3],[],[:],[$3])
fi
])
@ -135,7 +155,7 @@ AC_DEFUN([_MOO_AC_CHECK_PYTHON_UNIX],[
AC_DEFUN([MOO_AC_CHECK_PYTHON],[
AC_MSG_NOTICE([checking for headers and libs required to compile python extensions])
AC_REQUIRE([MOO_AC_CHECK_OS])
if test x$MOO_OS_MINGW = xyes; then
if test x$MOO_OS_MINGW = xyes -a x$cross_compiling = xyes; then
MOO_AM_PYTHON_DEVEL_CROSS_MINGW([$2],[$3])
else
_MOO_AC_CHECK_PYTHON_UNIX([$1],[$2],[$3])

View File

@ -4,6 +4,11 @@ AC_DEFUN([UGLY_FAKE_FUN],[
7a7f11d6c077a99463a4fbefe1c09a20 moo-os.m4
bf3d04c32399bca1bbe75282947e1041 moo-version.m4
5e18022b42d6f056ef24b748181c848b ugly.m4
f3434833becc2338bc7ce8ff0a925987 libtool.m4
152941207b2a2348e1687f6d9430fdd4 ltoptions.m4
bc2f6032c98896249eadb56177c7d357 ltsugar.m4
8ad9271cd6f868874ffff4223e2ff0ee ltversion.m4
13eeb5a2026d18ffe6428827fc7ab406 lt~obsolete.m4
7e6e4832fed0fed1850ee168e65d9d4f moo-comps.m4
ab00dc3cc5a6899ecd789fa5d5070abd moo-debug.m4
d86d9c0fc3a7e74d0cad083d0b7fee15 moo-dirs.m4
@ -17,7 +22,7 @@ d5aeeaa47fa88297cc36e17fbbc47102 moo-lib.m4
6491d45e29f5f2020a545049d6221092 moo-pcre.m4
73c409392837c8c504541c1fa517f3e0 moo-pygtk.m4
87cb0e8cdecb72d87d7404eb20546f26 moo-python-cross-mingw.m4
12a5998e546fe6991597af5dc0cebda1 moo-python.m4
bda375dcb0e9befabf652b123ce042ad moo-python.m4
9b1a1ecc886394e26ba9ff62a057d687 moo-xml.m4
bc98c93988f2674585e76829e8b172e0 configure.ac
])

View File

@ -20,7 +20,7 @@
#include "config.h"
#include <string.h>
#include <glib/gi18n.h>
#include <mooutils/mooi18n.h>
#include "eggsmclient.h"
#include "eggsmclient-private.h"

View File

@ -18,6 +18,7 @@
#include "mooutils/moodialogs.h"
#include "mooutils/mooi18n.h"
#include "glade/mooaccelbutton-gxml.h"
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>

2041
po/moo.pot

File diff suppressed because it is too large Load Diff

24
ugly/bdist-top.mk Normal file
View File

@ -0,0 +1,24 @@
# -%- lang: makefile; indent-width: 8; use-tabs: true -%-
bdistdir = $(PACKAGE)-$(VERSION)
ug_remove_bdistdir = \
{ test ! -d $(bdistdir) \
|| { find $(bdistdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -fr $(bdistdir); }; }
bdist-zip: bdistdir
rm -f $(bdistdir).zip
zip -9 -r $(bdistdir).zip $(bdistdir)
$(ug_remove_bdistdir)
bdistdir:
$(ug_remove_bdistdir)
test -d $(bdistdir) || mkdir $(bdistdir)
bdistdir=`$(am__cd) $(bdistdir) && pwd`; \
$(MAKE) $(AM_MAKEFLAGS) bdistdir="$$bdistdir" bdistsubdir
-find $(bdistdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r $(bdistdir)

57
ugly/bdist.mk Normal file
View File

@ -0,0 +1,57 @@
# -%- lang: makefile; indent-width: 8; use-tabs: true -%-
BDIST_SUBDIRS = $(SUBDIRS)
if MOO_OS_MINGW
BDIST_FILES += $(BWIN32_FILES)
BDIST_EXTRA += $(BWIN32_EXTRA)
else
if MOO_OS_DARWIN
BDIST_FILES += $(BMAC_FILES)
BDIST_EXTRA += $(BMAC_EXTRA)
else
BDIST_FILES += $(BFDO_FILES)
BDIST_EXTRA += $(BFDO_EXTRA)
endif
endif
bdistsubdir: $(BDIST_FILES) $(BDIST_EXTRA)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(BDIST_FILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(bdistdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(bdistdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(bdistdir)$$dir || exit 1; \
else \
test -f $(bdistdir)/$$file \
|| cp -p $$d/$$file $(bdistdir)/$$file \
|| exit 1; \
fi; \
done
bdistdir=`$(am__cd) $(bdistdir) && pwd`; \
list='$(BDIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
(cd $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
bdistdir="$$bdistdir" \
bdistsubdir) \
|| exit 1; \
fi; \
done
bdistdir=`$(am__cd) $(bdistdir) && pwd`; \
list='$(BDIST_EXTRA)'; for target in $$list; do \
$(MAKE) $(AM_MAKEFLAGS) bdistdir="$$bdistdir" $$target || exit 1; \
done

View File

@ -1 +1,19 @@
repo/glade.mk
# -%- lang: makefile; indent-width: 8; use-tabs: true -%-
# UGLY_MK_TRIGGER = GLADE_FILES
ugly_glade2h = $(top_srcdir)/ugly/glade2h.sh
ugly_xml2h = $(top_srcdir)/ugly/xml2h.sh
ugly_glade_mk = $(top_srcdir)/ugly/glade.mk
glade/%-glade.h: glade/%.glade $(ugly_xml2h) $(ugly_glade2h) $(ugly_glade_mk)
@mkdir -p `dirname $@`
$(ugly_glade2h) $< > $@.tmp && mv $@.tmp $@
%-glade.h: %.glade $(ugly_xml2h) $(ugly_glade2h) $(ugly_glade_mk)
@mkdir -p `dirname $@`
$(ugly_glade2h) $< > $@.tmp && mv $@.tmp $@
ugly_glade_sources = $(GLADE_FILES:%.glade=%-glade.h)
BUILT_SOURCES += $(ugly_glade_sources)
CLEANFILES += $(ugly_glade_sources)
EXTRA_DIST += $(GLADE_FILES) $(ugly_xml2h) $(ugly_glade2h)

View File

@ -1 +1,17 @@
repo/glade2.mk
# -%- lang: makefile; indent-width: 8; use-tabs: true -%-
# UGLY_MK_TRIGGER = GLADE2_FILES
ugly_glade2c = $(top_srcdir)/ugly/glade2c.py
ugly_glade2_mk = $(top_srcdir)/ugly/glade2.mk
glade/%-gxml.h: glade/%.glade $(ugly_glade2c) $(ugly_glade2_mk)
@mkdir -p `dirname $@`
$(PYTHON) $(ugly_glade2c) $< > $@.tmp && mv $@.tmp $@
%-gxml.h: %.glade $(ugly_glade2c) $(ugly_glade2_mk)
@mkdir -p `dirname $@`
$(PYTHON) $(ugly_glade2c) $< > $@.tmp && mv $@.tmp $@
ugly_glade2_sources = $(GLADE2_FILES:%.glade=%-gxml.h)
BUILT_SOURCES += $(ugly_glade2_sources)
EXTRA_DIST += $(GLADE2_FILES) $(ugly_glade2c) $(ugly_glade2_sources)

View File

@ -1 +1,339 @@
repo/glade2c.py
#! /usr/bin/env python
import os.path
import sys
import getopt
import xml.dom
import xml.dom.minidom as minidom
import StringIO
def name_is_nice(name):
return name[-1:] not in "0123456789"
class Widget(object):
def __init__(self, node, name, class_name):
object.__init__(self)
self.node = node
self.name = name
self.class_name = class_name
self.real_name = node.getAttribute('id')
if self.name in ['new', 'delete']:
self.name += '_'
class GladeXml(object):
def __init__(self, root, buffer, params):
object.__init__(self)
assert root is not None
self.root = root
self.buffer = buffer
self.rootName = root.getAttribute("id")
if ':' in self.rootName:
self.rootName, real_class_name = self.rootName.split(':')
self.widgets = []
def check_node(node):
if node.tagName != "widget":
return None
name = node.getAttribute("id")
class_name = node.getAttribute("class")
if ':' in name:
real_name, real_class_name = name.split(':')
name = real_name
class_name = real_class_name
if name_is_nice(name):
self.widgets.append(Widget(node, name, class_name))
return None
walk_node(root, False, check_node)
def format_buffer(self):
out = StringIO.StringIO()
for l in self.buffer.splitlines():
out.write('"')
out.write(l.replace('\\', '\\\\').replace('"', '\\"'))
out.write('"\n')
ret = out.getvalue()
out.close()
return ret
class ConvertParams(object):
def __init__(self):
object.__init__(self)
self.root = None
self.id_map = {}
self.struct_name = None
self.StructName = None
def map_id(self, id, ClassName, CLASS_TYPE = None):
self.id_map[id] = (ClassName, CLASS_TYPE)
def walk_node(node, walk_siblings, func, *args):
while node is not None:
if node.nodeType == xml.dom.Node.ELEMENT_NODE:
ret = func(node, *args)
if ret is not None:
return ret
ret = walk_node(node.firstChild, True, func, *args)
if ret is not None:
return ret
if not walk_siblings:
break
node = node.nextSibling
return None
def find_roots(dom, root_name):
def check_node(node, name):
if node.tagName != "widget":
return None
if name is None and name_is_nice(node.getAttribute("id")):
return node
if node.getAttribute("id") == name:
return node
roots = []
for toplevel in dom.documentElement.childNodes:
root = walk_node(toplevel, False, check_node, root_name)
if root:
roots.append(root)
return roots
def write_file(gxml, params, out, xml_buf_name, first_widget):
tmpl_start = """\
#include <mooutils/mooglade.h>
#include <mooutils/mooi18n.h>
#include <gtk/gtk.h>
static const char %(glade_xml)s[] =
%(glade_xml_content)s
;
"""
tmpl = """\
typedef struct %(XmlStruct)s %(XmlStruct)s;
struct %(XmlStruct)s {
MooGladeXML *xml;
%(glade_xml_widgets_decl)s
};
static void
_%(xml_struct)s_free (%(XmlStruct)s *xml)
{
if (xml)
{
g_object_unref (xml->xml);
g_free (xml);
}
}
G_GNUC_UNUSED static %(XmlStruct)s *
%(xml_struct)s_get (gpointer widget)
{
return g_object_get_data (widget, "moo-generated-glade-xml");
}
static void
_%(xml_struct)s_finish_build (%(XmlStruct)s *xml)
{
%(glade_xml_widgets_defs)s
g_object_set_data_full (G_OBJECT (xml->%(root)s), "moo-generated-glade-xml",
xml, (GDestroyNotify) _%(xml_struct)s_free);
}
static void
%(xml_struct)s_build (%(XmlStruct)s *xml)
{
moo_glade_xml_parse_memory (xml->xml, %(glade_xml)s, -1, "%(root)s", NULL);
_%(xml_struct)s_finish_build (xml);
}
static void
%(xml_struct)s_fill (%(XmlStruct)s *xml, GtkWidget *root)
{
moo_glade_xml_fill_widget (xml->xml, root, %(glade_xml)s, -1, "%(root)s", NULL);
_%(xml_struct)s_finish_build (xml);
}
static %(XmlStruct)s *
%(xml_struct)s_new_empty (void)
{
%(XmlStruct)s *xml = g_new0 (%(XmlStruct)s, 1);
xml->xml = moo_glade_xml_new_empty (GETTEXT_PACKAGE);
%(glade_xml_widgets_map)s
return xml;
}
G_GNUC_UNUSED static %(XmlStruct)s *
%(xml_struct)s_new (void)
{
%(XmlStruct)s *xml = %(xml_struct)s_new_empty ();
%(xml_struct)s_build (xml);
return xml;
}
G_GNUC_UNUSED static %(XmlStruct)s *
%(xml_struct)s_new_with_root (GtkWidget *root)
{
%(XmlStruct)s *xml = %(xml_struct)s_new_empty ();
%(xml_struct)s_fill (xml, root);
return xml;
}
"""
buf = StringIO.StringIO()
if gxml.widgets:
print >> buf, ''
for w in gxml.widgets:
name = w.name
ct = params.id_map.get(name)
if ct is None:
class_name = w.class_name
else:
class_name = ct[0]
print >> buf, ' %s *%s;' % (class_name, name)
glade_xml_widgets_decl = buf.getvalue()
buf.close()
buf = StringIO.StringIO()
for w in gxml.widgets:
print >> buf, """\
xml->%(struct_mem)s = moo_glade_xml_get_widget (xml->xml, "%(glade_name)s");
g_assert (xml->%(struct_mem)s != NULL);""" % { 'struct_mem': w.name, 'glade_name': w.real_name }
glade_xml_widgets_defs = buf.getvalue()
buf.close()
buf = StringIO.StringIO()
for id in params.id_map:
ct = params.id_map.get(id)
if ct[1]:
type_name = ct[1]
else:
type_name = 'g_type_from_name ("%s")' % (ct[0],)
print >> buf, ' moo_glade_xml_map_id (xml->xml, "%s", %s);' % (id, type_name)
glade_xml_widgets_map = buf.getvalue()
buf.close()
dic = {
'glade_xml': '_' + params.struct_name + '_glade_xml',
'glade_xml_content': gxml.format_buffer(),
'root': gxml.rootName,
'XmlStruct': params.StructName,
'xml_struct': params.struct_name,
'glade_xml_widgets_decl': glade_xml_widgets_decl,
'glade_xml_widgets_defs': glade_xml_widgets_defs,
'glade_xml_widgets_map': glade_xml_widgets_map,
}
if xml_buf_name:
dic['glade_xml'] = xml_buf_name
if first_widget:
out.write(tmpl_start % dic)
out.write(tmpl % dic)
def convert_buffer(buf, params, output, filename):
dom = minidom.parseString(buf)
roots = find_roots(dom, params.root)
assert roots
close_output = False
xml_buf_name = None
if len(roots) > 1:
xml_buf_name = os.path.basename(filename).replace('-', '_').replace('.glade', '_glade_xml')
first_widget = True
has_StructName = params.StructName is not None
has_struct_name = params.StructName is not None
for root in roots:
params.root = root.getAttribute('id')
gxml = GladeXml(root, buf, params)
if not has_StructName:
params.StructName = gxml.rootName + 'Xml'
if not has_struct_name:
def S2s(name):
ret = ''
for i in range(len(name)):
c = name[i]
if i == 0:
ret += c.lower()
elif c.istitle() and not name[i-1].istitle():
ret += '_' + c.lower()
else:
ret += c
return ret
params.struct_name = S2s(params.StructName)
if output is None:
output = sys.stdout
elif isinstance(output, str) or isinstance(output, unicode):
output = open(output, 'w')
close_output = True
write_file(gxml, params, output, xml_buf_name, first_widget)
first_widget = False
if close_output:
output.close()
def convert_file(filename, params, output):
f = open(filename)
ret = convert_buffer(f.read(), params, output, filename)
f.close()
return ret
def usage():
print "Usage: %s [--map=id,ClassName,CLASS_TYPE...] [--output=outfile] FILE" % (sys.argv[0],)
def main(args):
params = ConvertParams()
try:
opts, files = getopt.getopt(args[1:], "hm:o:s:S:r:",
["help", "map=", "output=", "struct-name=", "StructName=", "root="])
except getopt.GetoptError, err:
print str(err)
usage()
return 2
output = None
for o, a in opts:
if o in ("-h", "--help"):
usage()
return 0
elif o in ("-m", "--map"):
t = a.split(',')
if len(t) == 3:
params.map_id(t[0], t[1], t[2])
elif len(t) == 2:
params.map_id(t[0], t[1])
else:
usage()
return 2
elif o in ("-o", "--output"):
output = a
elif o in ("-s", "--struct-name"):
params.struct_name = a
elif o in ("-S", "--StructName"):
params.StructName = a
elif o in ("-r", "--root"):
params.root = a
if len(files) != 1:
usage()
return 2
convert_file(files[0], params, output)
return 0
if __name__ == '__main__':
# args = ['glade2c', '-o', '/tmp/test.h', '-r', 'LuaPage',
# '-m', 'textview,MooTextView',
# '/tmp/test.glade']
# sys.exit(main(args))
sys.exit(main(sys.argv))

View File

@ -1 +1,10 @@
repo/glade2h.sh
#! /bin/sh
xml2h="`dirname $0`/xml2h.sh"
base=`basename "$1" .glade | sed -e "s/-/_/g"`
BASE=`echo $base | tr '[a-z]' '[A-Z]'`
echo "#ifndef ${BASE}_GLADE_H"
echo "#define ${BASE}_GLADE_H"
"$xml2h" "${base}_glade_xml" "$1" || exit 0
echo "#endif /* ${BASE}_GLADE_H */"

View File

@ -1 +1,36 @@
repo/glib-enums.mk
# -%- lang: makefile; indent-width: 8; use-tabs: true -%-
# UGLY_MK_TRIGGER = ENUM_HDRS
# ENUM_PREFIX
ugly_enum_hfile = $(ENUM_MODULE)-enums.h
ugly_enum_cfile = $(ENUM_MODULE)-enums.c
ugly_stamp_enum_hfile = stamp-$(ugly_enum_hfile)
ugly_stamp_enum_cfile = stamp-$(ugly_enum_cfile)
ugly_enum_prefix = $(ENUM_PREFIX)
BUILT_SOURCES += $(ugly_stamp_enum_hfile) $(ugly_stamp_enum_cfile)
CLEANFILES += $(ugly_stamp_enum_hfile) $(ugly_stamp_enum_cfile)
$(ugly_stamp_enum_hfile): $(ENUM_HDRS) Makefile
( HGUARD=`echo $(ugly_enum_hfile) | tr '[a-z.\-]' '[A-Z__]'` && cd $(srcdir) && \
$(GLIB_MKENUMS) --fhead "#ifndef $$HGUARD\n#define $$HGUARD\n\n#include <glib-object.h>\n" \
--fhead "\nG_BEGIN_DECLS\n\n\n" \
--fprod "/* enumerations from @filename@ */\n" \
--vhead "GType @enum_name@_get_type (void) G_GNUC_CONST;\n#define $(ugly_enum_prefix)_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n\n" \
--ftail "\nG_END_DECLS\n\n#endif /* $$HGUARD */" \
$(ENUM_HDRS) ) > $(ugly_enum_hfile).tmp \
&& (cmp -s $(ugly_enum_hfile).tmp $(srcdir)/$(ugly_enum_hfile) || cp $(ugly_enum_hfile).tmp $(srcdir)/$(ugly_enum_hfile) ) \
&& rm -f $(ugly_enum_hfile).tmp \
&& echo timestamp > $(@F)
$(ugly_stamp_enum_cfile): $(ENUM_HDRS) Makefile
( cd $(srcdir) && $(GLIB_MKENUMS) \
--fhead "#include \"$(ugly_enum_hfile)\"\n\n" \
--fprod "#include \"@filename@\"\n\n" \
--vhead "GType\n@enum_name@_get_type (void)\n{\n static GType etype;\n if (G_UNLIKELY (!etype))\n {\n static const G@Type@Value values[] = {" \
--vprod " { @VALUENAME@, (char*) \"@VALUENAME@\", (char*) \"@valuenick@\" }," \
--vtail " { 0, NULL, NULL }\n };\n etype = g_@type@_register_static (\"@EnumName@\", values);\n }\n return etype;\n}\n\n" \
$(ENUM_HDRS) ) > $(ugly_enum_cfile).tmp \
&& (cmp -s $(ugly_enum_cfile).tmp $(srcdir)/$(ugly_enum_cfile) || cp $(ugly_enum_cfile).tmp $(srcdir)/$(ugly_enum_cfile) ) \
&& rm -f $(ugly_enum_cfile).tmp \
&& echo timestamp > $(@F)

View File

@ -1 +1,22 @@
repo/i18n.mk
# -%- lang: makefile; indent-width: 8; use-tabs: true -%-
# UGLY_MK_TRIGGER = INI_IN_IN_FILES|DESKTOP_IN_FILES
# $(INI_IN_IN_FILES) should be a list of input *.ini.in.in files
# $(DESKTOP_IN_FILES) should be a list of input *.desktop.in files
%.ini.in: %.ini.in.in $(top_builddir)/config.status
cd $(top_builddir) && $(SHELL) ./config.status --file=$(subdir)/$@
# %.desktop: %.desktop.in
@MOO_INTLTOOL_DESKTOP_RULE@
# %.ini: %.ini.in
@MOO_INTLTOOL_INI_RULE@
ugly_ini_in_files = $(INI_IN_IN_FILES:.ini.in.in=.ini.in)
INI_FILES = $(ugly_ini_in_files:.ini.in=.ini)
DESKTOP_FILES = $(DESKTOP_IN_FILES:.desktop.in=.desktop)
CLEANFILES += $(INI_FILES) $(ugly_ini_in_files) $(DESKTOP_FILES)
EXTRA_DIST += $(INI_IN_IN_FILES) $(DESKTOP_IN_FILES)

View File

@ -1 +1,28 @@
repo/lt.mk
# -%- lang: makefile; indent-width: 8; use-tabs: true -%-
# UGLY_MK_TRIGGER = UGLY_LIBS
noinst_LTLIBRARIES =
noinst_LIBRARIES =
if MOO_BUILD_SHARED_LIB
noinst_LTLIBRARIES += @MODULE@.la
else
noinst_LIBRARIES += @MODULE@.a
endif
@MODULE@_la_SOURCES = $(@MODULE@_SOURCES_)
@MODULE@_a_SOURCES = $(@MODULE@_SOURCES_)
nodist_@MODULE@_la_SOURCES = $(nodist_@MODULE@_SOURCES_)
nodist_@MODULE@_a_SOURCES = $(nodist_@MODULE@_SOURCES_)
@MODULE@_la_LIBADD = $(@MODULE@_LIBADD_)
@MODULE@_a_LIBADD = $(@MODULE@_LIBADD_)
@MODULE@_la_LDFLAGS = $(@MODULE@_LDFLAGS_)
AM_CFLAGS = $(AM_CFLAGS_)
@MODULE@_a_CFLAGS = $(AM_CFLAGS_)
AM_CXXFLAGS = $(AM_CXXFLAGS_)
@MODULE@_a_CXXFLAGS = $(AM_CXXFLAGS_)

22
ugly/moc-wrapper Normal file
View File

@ -0,0 +1,22 @@
#! /bin/sh
# moc-wrapper moc srcdir output infiles...
moc="$1"
shift
srcdir="$1"
shift
output="$1"
shift
cat_args=
moc_args=
for arg do
cat_args="$cat_args $srcdir/$arg"
moc_args="$moc_args -f$arg"
done
(cat $cat_args | $moc $moc_args -o $output.tmp) || exit 1
(sed 's/\*\* Created: [^*]*$/** Created: today/' $output.tmp > $output.tmp2) || exit 1
(cmp -s $output.tmp2 $output || mv $output.tmp2 $output) || exit 1
rm -f $output.tmp $output.tmp2

22
ugly/moc.mk Normal file
View File

@ -0,0 +1,22 @@
# -%- lang: makefile; indent-width: 8; use-tabs: true -%-
# UGLY_MK_TRIGGER = MOC_HDRS
##################################################################################
#
# moc
#
# input: MOC_HDRS - list of .h files to be moc'ed
#
ugly_moc_wrapper = $(top_srcdir)/ugly/moc-wrapper
all-classes-moc.cpp.stamp: $(MOC_HDRS) Makefile $(ugly_moc_wrapper)
$(ugly_moc_wrapper) "$(QT_MOC) $(MOC_FLAGS)" $(srcdir) all-classes-moc.cpp $(MOC_HDRS) && echo stamp > $@
ugly_moc_sources = all-classes-moc.cpp
ugly_moc_stamps = all-classes-moc.cpp.stamp
EXTRA_DIST += $(MOC_HDRS) $(ugly_moc_wrapper)
BUILT_SOURCES += $(ugly_moc_stamps)
CLEANFILES += $(ugly_moc_sources) $(ugly_moc_stamps)
nodist_@MODULE@_SOURCES += $(ugly_moc_sources)

View File

@ -1 +1,13 @@
repo/mooui.mk
# -%- lang: makefile; indent-width: 8; use-tabs: true -%-
# UGLY_MK_TRIGGER = MOO_UI_FILES
ugly_ui2h = $(top_srcdir)/ugly/xml2h.sh
%-ui.h: %.xml $(ugly_ui2h)
$(SHELL) $(ugly_ui2h) `basename "$*" .xml | sed -e "s/-/_/"`_ui_xml $< > $@.tmp && mv $@.tmp $@
ugly_ui_sources = $(MOO_UI_FILES:%.xml=%-ui.h)
BUILT_SOURCES += $(ugly_ui_sources)
CLEANFILES += $(ugly_ui_sources)
EXTRA_DIST += $(MOO_UI_FILES) $(ugly_ui2h)

34
ugly/pch.mk Normal file
View File

@ -0,0 +1,34 @@
# -%- lang: makefile; indent-width: 8; use-tabs: true -%-
# UGLY_MK_TRIGGER = PCH_HEADER
EXTRA_DIST += $(PCH_HEADER)
# ugly_base_compile_c = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
ugly_base_compile_cxx = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
# ugly_base_compile_objc = $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS)
# COMPILE = $(ugly_base_compile_c)
CXXCOMPILE = $(ugly_base_compile_cxx)
# OBJCCOMPILE = $(ugly_base_compile_objc)
if MOO_ENABLE_PCH
BUILT_SOURCES += $(ugly_pch_files)
CLEANFILES += $(ugly_pch_files)
ugly_pch_name = precompiled-header-name
ugly_pch_files =
# ugly_pch_files += $(ugly_pch_name)-c.gch
ugly_pch_files += $(ugly_pch_name)-c++.gch
ugly_pch_mk = $(top_srcdir)/ugly/pch.mk
# $(ugly_pch_name)-c.gch: $(PCH_HEADER) $(ugly_pch_mk)
# $(ugly_base_compile_c) -x c-header -c $< -o $@
$(ugly_pch_name)-c++.gch: $(PCH_HEADER) $(ugly_pch_mk)
$(ugly_base_compile_cxx) -x c++-header -c $< -o $@
# COMPILE += -include $(ugly_pch_name)-c -Winvalid-pch
CXXCOMPILE += -include $(ugly_pch_name)-c++ -Winvalid-pch
endif

38
ugly/qrc.mk Normal file
View File

@ -0,0 +1,38 @@
# -%- lang: makefile; indent-width: 8; use-tabs: true -%-
# UGLY_MK_TRIGGER = RESOURCES
##################################################################################
#
# qrc
#
# input: RESOURCES - list of .qrc files
# QT_QRC_DEPS
#
ugly_qrc_name = @MODULE@
ugly_qrc_cpp = @MODULE@-qrc.cpp
$(ugly_qrc_cpp): $(RESOURCES) $(QT_QRC_DEPS)
$(QT_RCC) -o $(ugly_qrc_cpp).tmp -name $(ugly_qrc_name) \
$(addprefix $(srcdir)/,$(RESOURCES)) && mv $(ugly_qrc_cpp).tmp $(ugly_qrc_cpp)
EXTRA_DIST += $(RESOURCES) $(QT_QRC_DEPS)
BUILT_SOURCES += $(ugly_qrc_cpp)
CLEANFILES += $(ugly_qrc_cpp)
nodist_@MODULE@_SOURCES += $(ugly_qrc_cpp)
dist-hook:
copyfile() { \
dest="$(distdir)/`dirname $$1`"; \
test -f $(distdir)/$$1 || { \
if test -f $(srcdir)/$$1; then \
$(MKDIR_P) "$$dest" || exit 1; \
echo cp -p "$(srcdir)/$$1" "$$dest/"; \
cp -p "$(srcdir)/$$1" "$$dest/" || exit 1; \
fi; \
}; \
} ; \
for qrc in $(RESOURCES); do \
for f in `grep '<file' < $(srcdir)/$$qrc | sed -e 's%<file.*>\(.*\)</file>%\1%'`; do \
copyfile $$f; \
done; \
done

35
ugly/qtest.cpp Normal file
View File

@ -0,0 +1,35 @@
#include "@test@-t.h"
#include <moo/unit-tests.h>
#include <QtCore>
#ifndef UnitTestMainClass
#error "`UnitTestMainClass' not defined"
#endif
#ifndef UnitTestAppClass
#define UnitTestAppClass QApplication
#endif
namespace moo {
namespace test {
class Tester {
public:
int exec(int argc, char *argv[])
{
UnitTestMainClass test;
return QTest::qExec(&test, argc, argv);
}
};
}
}
int main(int argc, char *argv[])
{
UnitTestAppClass app(argc, argv);
moo::test::Tester t;
return t.exec(argc, argv);
}
#include "@test@-test.moc"

49
ugly/qtest.mk Normal file
View File

@ -0,0 +1,49 @@
# -%- lang: sh; indent-width: 8; use-tabs: true -%-
# UGLY_MK_TRIGGER = QTESTS
# UGLY_MK_VARS = EXTRA_PROGRAMS
# UGLY_MK_TYPE = sh
##################################################################################
#
# qtest
#
# input: QTESTS - list of tests. There must be corresponding -t.h files which
# contain the testing classes.
#
MODULE=`echo $MODULE | sed 's/\./_/'`
cat <<\EOFEOF
TESTS =
ugly_qtest_cpp = $(top_srcdir)/ugly/qtest.cpp
if MOO_ENABLE_UNIT_TESTS
TESTS += $(QTESTS:=-test)
EXTRA_PROGRAMS += $(QTESTS:=-test)
BUILT_SOURCES += $(QTESTS:=-test.cpp) $(QTESTS:=-test.moc)
CLEANFILES += $(QTESTS:=-test.cpp) $(QTESTS:=-test.moc)
%-test.cpp: $(ugly_qtest_cpp)
sed -e 's/@test@/$*/g' $(ugly_qtest_cpp) > $*-test.cpp.tmp && mv $*-test.cpp.tmp $*-test.cpp
%-test.moc: %-t.h
$(QT_MOC) -o$*-test.moc.tmp $(srcdir)/$*-t.h && mv $*-test.moc.tmp $*-test.moc
EOFEOF
for name in $QTESTS; do
var=`echo $name | sed 's/-/_/g'`
cat <<EOFEOF
${var}_test_SOURCES = ${name}-t.h
nodist_${var}_test_SOURCES = ${name}-test.cpp
${var}_test_LDADD = \$(patsubst %.cpp,%.o,\$(filter %.cpp,\$(filter-out main.cpp,\$(${MODULE}_SOURCES) \$(nodist_${MODULE}_SOURCES)))) \$(qtest_ldadd)
EOFEOF
done
cat <<\EOFEOF
endif
EXTRA_DIST += $(QTESTS:=-t.h) $(ugly_qtest_cpp)
EOFEOF

View File

@ -1 +1,24 @@
repo/rc.mk
# -%- lang: makefile; indent-width: 8; use-tabs: true -%-
# UGLY_MODULE_TRIGGER = RC_IN_FILE
# UGLY_MODULE_VARS = LDFLAGS
# mod_$(RC_IN_FILE) should be a list of input *.rc.in files
if MOO_OS_MINGW
%.res: %.rc.in $(top_builddir)/config.status
cd $(top_builddir) && \
$(SHELL) ./config.status --file=$(subdir)/$*.rc && \
cd $(subdir) && \
$(WINDRES) -i $*.rc --input-format=rc -o $@ -O coff && \
rm $*.rc
@MODULE@_ugly_res_file = $(@MODULE@_RC_IN_FILE:.rc.in=.res)
CLEANFILES += $(@MODULE@_ugly_res_file)
BUILT_SOURCES += $(@MODULE@_ugly_res_file)
@MODULE@_LDFLAGS += -Wl,$(@MODULE@_ugly_res_file)
endif
EXTRA_DIST += $(@MODULE@_RC_IN_FILE)

329
ugly/ugly
View File

@ -1 +1,328 @@
repo/ugly
#! /bin/sh
# DEBUG=yes
# DEBUG=verbose
print_debug() {
if [ -z "$current_func" ]; then
echo "$@" > /dev/stderr
else
echo "$current_func: $@" > /dev/stderr
fi
}
debug_v() {
if [ "$DEBUG" = "verbose" ]; then
print_debug "$@"
fi
}
debug() {
if [ "$DEBUG" = "yes" -o "$DEBUG" = "verbose" ]; then
print_debug "$@"
fi
}
find_input() {
current_func=find_input
debug_v "dir: $1"
if [ -f $1/Makefile.ug ]; then
echo $1/Makefile.ug
for sd in `ls "$1"`; do
if [ -d "$1/$sd" ]; then
debug_v "going into: $1/$sd"
find_input "$1/$sd"
fi
done
fi
}
preprocess() {
# preprocess input output
sed -e :a -e '/\\$/N; s/\\\n//; ta' "$1" | sed 's/#.*//' > $2
}
extract_var() {
# extract_var Makefile NAME
value=`grep '\b'$2'\b' $1`
if [ -n "$value" ]; then
value=`echo "$value" | sed 's/'$2'[ ]*=//'`
fi
value=`echo $value | tr -d " "`
echo "$value"
}
extract_vars() {
# extract_vars Makefile
grep -E '^[A-Za-z0-9_]+[ \t]*=' $1 | sed 's/^\([a-zA-Z0-9_]*\)[ \t]*=[ \t]*\(.*\)/export \1='"'"'\2'"'"'/g'
}
extract_meta_var() {
current_func=extract_meta_var
# extract_meta_var Makefile NAME
value=`grep -E '^#[ \t]*\b'$2'\b' $1`
if [ -n "$value" ]; then
value=`echo "$value" | sed 's/^#[ ]*'$2'[ ]*=//'`
fi
value=`echo $value | tr -d " "`
echo "$value"
}
write_mk() {
# write_mk mk_mod MODULE
echo ""
echo "# begin $1"
echo ""
case "`extract_meta_var ugly/$1 UGLY_MK_TYPE`" in
sh)
MODULE="$2" /bin/sh -c ". $global_vars && /bin/sh ugly/$1"
;;
"")
cat ugly/$1 | sed 's/@MODULE@/'$2'/g'
;;
*)
echo "oops"
exit 1
;;
esac
echo ""
echo 'UGLY_DEPS += $(top_srcdir)/ugly/'$1
echo 'EXTRA_DIST += $(top_srcdir)/ugly/'$1
echo ""
echo "# end $1"
echo ""
}
write_ugly_pre_mk() {
cat << \_EOFEOF
#
# begin ugly stuff
#
_EOFEOF
cat ugly/repo/ugly-pre.mk
}
do_makefile() {
current_func=do_makefile
infile="$1"
subdir=`dirname $infile | sed 's,^\./,,'`
outbase=`basename $infile .ug`
out=$subdir/$outbase.am
if [ "$subdir" = . ]; then
rel_topdir=.
mk_prefix="mk"
else
rel_topdir=`echo $subdir | sed 's,[^/]*,..,g'`
mk_prefix="$rel_topdir/mk"
fi
out_tmp=`dirname $out`/.`basename $out`.tmp
out_pp=`dirname $out`/.`basename $out`.pp#
preprocess $infile $out_pp
global_vars=`dirname $out`/.globalvars
extract_vars $out_pp > $global_vars
modname=`extract_var $out_pp MODULE | sed 's/\./_/g'`
debug "processing $infile, output: $out, subdir: $subdir, topdir: $rel_topdir, module: $modname"
write_ugly_pre_mk > $out_tmp
want_mk=
all_modnames=
for file_mk in `cd ugly && ls *.mk 2>/dev/null`; do
if [ ! -f ugly/$file_mk ]; then
continue
fi
trigger=`extract_meta_var ugly/$file_mk UGLY_MK_TRIGGER`
if [ -n "$trigger" ]; then
if grep -E "$trigger" $out_pp > /dev/null 2>&1; then
debug $out matches $trigger from $file_mk
want_mk="$want_mk $file_mk"
continue
fi
fi
trigger=`extract_meta_var ugly/$file_mk UGLY_MODULE_TRIGGER`
if [ -n "$trigger" ]; then
if grep -E "$trigger" $out_pp > /dev/null 2>&1; then
lines=`grep -E "$trigger" $out_pp 2>/dev/null`
for l in $lines; do
w=`echo $l | grep -E "$trigger" | tr -d " "`
if [ -n "$w" ]; then
m=`echo $w | sed 's/\(\w*\)_'$trigger'.*/\1/'`
if [ "$m" != "$w" ]; then
debug found module $m
all_modnames="$all_modnames $m"
eval "${m}_written=false"
eval "${m}_want_mk=\"\$${m}_want_mk $file_mk\""
# if [ -n "$m" -a "$m" != "$w" ]; then
# debug "$w in $out matches $trigger from $file_mk"
# write_mk $file_mk $m >> $out_tmp
# fi
fi
fi
done
fi
fi
done
for file_mk in $want_mk; do
debug "writing code for $file_mk"
vars=`extract_meta_var ugly/$file_mk UGLY_MK_VARS`
debug "extra vars: $vars"
for var in $vars; do
eval "var_written=\$var_${var}_written"
if [ "$var_written" = "true" ]; then
continue
fi
debug_v writing "$var"
eval "var_${var}_written=true"
echo "$var =" >> $out_tmp
done
done
for mod in $all_modnames; do
eval "mod_written=\$${mod}_written"
if $mod_written; then
continue
fi
debug "writing code for module $mod"
eval "${mod}_written=true"
eval "mod_want_mk=\$${mod}_want_mk"
debug "writing variables from $mod_want_mk for module '$mod'"
mod_vars=
for file_mk in $mod_want_mk; do
mod_vars="$mod_vars `extract_meta_var ugly/$file_mk UGLY_MODULE_VARS`"
done
debug "extra vars: $mod_vars"
for var in $mod_vars; do
eval "mod_var_${var}_written=false"
done
for var in $mod_vars; do
eval "mod_var_written=\$mod_var_${var}_written"
if $mod_var_written; then
continue
fi
debug_v writing "${mod}_$var"
eval "mod_var_${var}_written=true"
echo "${mod}_$var =" >> $out_tmp
done
done
cat >> $out_tmp << _EOFEOF
#
# end ugly stuff
#
_EOFEOF
cat $infile >> $out_tmp || exit $?
cat >> $out_tmp << _EOFEOF
#
# begin ugly stuff
#
_EOFEOF
for file_mk in $want_mk; do
write_mk $file_mk $modname >> $out_tmp
done
for mod in $all_modnames; do
eval "${mod}_written=false"
done
for mod in $all_modnames; do
eval "mod_written=\$${mod}_written"
if $mod_written; then
continue
fi
debug "writing $file_mk code for module $mod"
eval "${mod}_written=true"
eval "mod_want_mk=\$${mod}_want_mk"
debug "doing $mod_want_mk for module '$mod'"
for file_mk in $mod_want_mk; do
write_mk $file_mk $mod >> $out_tmp
done
done
cat ugly/repo/bdist.mk >> $out_tmp
cat ugly/repo/ugly-post.mk >> $out_tmp
if [ "$subdir" = . ]; then
cat ugly/repo/bdist-top.mk >> $out_tmp
cat ugly/repo/ugly-top.mk >> $out_tmp
else
cat ugly/repo/ugly-sub.mk >> $out_tmp
fi
cat >> $out_tmp << _EOFEOF
#
# end ugly stuff
#
_EOFEOF
rm -f $out_pp
rm -f $global_vars
mv $out_tmp $out || exit $?
}
ugly_stamp=m4/ugly-stamp.m4
generate_ugly_stamp() {
out_tmp="$ugly_stamp.tmp"
echo "AC_DEFUN([UGLY_FAKE_FUN],[" > $out_tmp || exit 1
for arg; do
if [ ! -f "$arg" ]; then
echo "OOPS" >&2
elif [ ! "$arg" -ef "$ugly_stamp" ]; then
md5=`md5sum "$arg" | awk '{ print $1; }'`
name=`basename "$arg"`
echo "$md5 $name" >> $out_tmp
fi
done
echo "])" >> $out_tmp
echo >> $out_tmp
echo "AC_DEFUN([UGLY_STAMP],[])" >> $out_tmp
mv $out_tmp $ugly_stamp || exit 1
}
if [ -z "$1" ]; then
if [ ! -f "$ugly_stamp" ]; then
generate_ugly_stamp
fi
top_srcdir=.
input=`find_input .`
elif [ "$1" = "--stamp" ]; then
shift
generate_ugly_stamp "$@"
top_srcdir=.
input=`find_input .`
else
top_srcdir="$1"
input="$2/Makefile.ug"
fi
cd $top_srcdir
for f in $input; do
( do_makefile "$f" )
done

10
ugly/ugly-post.mk Normal file
View File

@ -0,0 +1,10 @@
# begin ugly-post.mk
# -%- lang: makefile; indent-width: 8; use-tabs: true -%-
$(srcdir)/Makefile.am: $(srcdir)/Makefile.ug $(UGLY_DEPS)
@top_srcdir=`cd $(top_srcdir) && pwd`; \
echo 'cd $(srcdir) && $(SHELL) $$top_srcdir/ugly/ugly $$top_srcdir $(subdir)'; \
cd $(srcdir) && $(SHELL) $$top_srcdir/ugly/ugly $$top_srcdir $(subdir) && exit 0; \
exit 1;
# end ugly-post.mk

52
ugly/ugly-pre.mk Normal file
View File

@ -0,0 +1,52 @@
# begin ugly-pre.mk
# -%- lang: makefile; indent-width: 8; use-tabs: true -%-
EXTRA_DIST =
BUILT_SOURCES =
CLEANFILES =
DISTCLEANFILES =
EXTRA_DIST += \
Makefile.ug
BDIST_FILES =
BDIST_EXTRA =
UGLY = $(top_srcdir)/ugly/ugly
UGLY_DEPS = \
$(UGLY) \
$(top_srcdir)/ugly/repo/ugly-pre.mk \
$(top_srcdir)/ugly/repo/ugly-post.mk \
$(top_srcdir)/ugly/repo/ugly-sub.mk \
$(top_srcdir)/ugly/repo/bdist.mk
UGLY_STAMP_DEPS = $(filter-out $(top_srcdir)/m4/ugly-stamp.m4,$(am__aclocal_m4_deps))
BUILT_SOURCES += ugly-pre-build-stamp
UGLY_PRE_BUILD_TARGETS =
UGLY_CLEAN_TARGETS =
ugly-pre-build-stamp: $(UGLY_PRE_BUILD_TARGETS)
@echo stamp > ugly-pre-build-stamp
clean-local: $(UGLY_CLEAN_TARGETS)
UGLY_SUBDIRS =
UGLY_PRE_BUILD_TARGETS += ugly-subdirs-stamp
UGLY_CLEAN_TARGETS += delete-ugly-subdir-makefile
ugly-subdirs-stamp: Makefile $(top_srcdir)/ugly/repo/ugly-subdir-Makefile
@if test -n "$(UGLY_SUBDIRS)"; then \
for d in $(UGLY_SUBDIRS); do \
mkdir -p $$d || exit 1; \
cp $(top_srcdir)/ugly/repo/ugly-subdir-Makefile $$d/Makefile || exit 1; \
done; \
fi
@echo stamp > ugly-subdirs-stamp
delete-ugly-subdir-makefile:
@if test -n "$(UGLY_SUBDIRS)"; then \
for d in $(UGLY_SUBDIRS); do \
rm -f $$d/Makefile || exit 1; \
done; \
fi
CLEANFILES += ugly-pre-build-stamp ugly-subdirs-stamp
# end ugly-pre.mk

7
ugly/ugly-sub.mk Normal file
View File

@ -0,0 +1,7 @@
# begin ugly-sub.mk
# -%- lang: makefile; indent-width: 8; use-tabs: true -%-
$(top_srcdir)/m4/ugly-stamp.m4: $(UGLY_STAMP_DEPS)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) m4/ugly-stamp.m4
# end ugly-sub.mk

View File

@ -0,0 +1,2 @@
%.lo %.o:
@cd .. && make $@

25
ugly/ugly-top.mk Normal file
View File

@ -0,0 +1,25 @@
# begin ugly-top.mk
# -%- lang: makefile; indent-width: 8; use-tabs: true -%-
EXTRA_DIST += \
ugly/ugly \
ugly/repo/ugly-top.mk \
ugly/repo/ugly-sub.mk \
ugly/repo/ugly-pre.mk \
ugly/repo/ugly-post.mk \
ugly/repo/bdist.mk \
ugly/repo/bdist-top.mk \
ugly/repo/ugly-subdir-Makefile
UGLY_DEPS += \
ugly/repo/bdist-top.mk \
ugly/repo/ugly-top.mk
$(top_srcdir)/m4/ugly-stamp.m4: $(UGLY_STAMP_DEPS)
files=""; for file in $(UGLY_STAMP_DEPS); do \
dir=`dirname $$file`; dir=`cd $$dir && pwd`; \
files="$$files $$dir/`basename $$file`"; \
done && \
cd $(srcdir) && $(SHELL) ./ugly/ugly --stamp $$files
# end ugly-top.mk

19
ugly/uic-wrapper Normal file
View File

@ -0,0 +1,19 @@
#! /bin/sh
# uic-wrapper uic srcdir infiles...
uic="$1"
shift
srcdir="$1"
shift
gen_one() {
"$uic" -o ui_$1.h.tmp $srcdir/$1.ui || exit 1
sed 's/\*\* Created: [^*]*$/** Created: today/' ui_$1.h.tmp > ui_$*.h.tmp2 || exit 1
(cmp -s ui_$1.h.tmp2 ui_$1.h || mv ui_$1.h.tmp2 ui_$1.h) || exit 1
rm -f ui_$1.h.tmp ui_$1.h.tmp2 || exit 1
}
for arg do
gen_one $arg
done

20
ugly/uic.mk Normal file
View File

@ -0,0 +1,20 @@
# -%- lang: makefile; indent-width: 8; use-tabs: true -%-
# UGLY_MK_TRIGGER = FORMS
##################################################################################
#
# uic
#
# input: FORMS - list of .ui files
#
ugly_uic_wrapper = $(top_srcdir)/ugly/uic-wrapper
ugly_ui_names = $(patsubst %.ui,%,$(FORMS))
ui.h.stamp: $(FORMS) Makefile $(ugly_uic_wrapper)
$(ugly_uic_wrapper) $(QT_UIC) $(srcdir) $(ugly_ui_names) && echo stamp > ui.h.stamp
EXTRA_DIST += $(FORMS) $(ugly_uic_wrapper)
BUILT_SOURCES += ui.h.stamp
ugly_ui_headers = $(patsubst %.ui,ui_%.h,$(FORMS))
CLEANFILES += $(ugly_ui_headers) ui.h.stamp
nodist_@MODULE@_SOURCES += $(ugly_ui_headers)

View File

@ -1 +1,35 @@
repo/xml2h.sh
#! /bin/sh
define=false
while true; do
case "$1" in
--define)
define=true
shift
;;
*)
break
;;
esac
done
if [ $# != 2 ]; then
echo "usage: $0 [--define] <var_name> <file_name>" > /dev/stderr
exit 1
fi
VARNAME="$1"
INPUT="$2"
echo "/* -*- C -*- */"
if $define; then
echo "#define $VARNAME \\"
sed 's/"/\\"/g' "$INPUT" | sed 's/^\(.*\)$/"\1\\n"\\/' || exit $?
echo "\"\""
else
echo "static const char $VARNAME [] = \"\""
sed 's/"/\\"/g' "$INPUT" | sed 's/^\(.*\)$/"\1\\n"/' || exit $?
echo ";"
fi

View File

@ -1 +1,25 @@
repo/yacc.mk
# -%- lang: makefile; indent-width: 8; use-tabs: true -%-
# UGLY_MK_TRIGGER = YACC_FILES|YACC_PP_FILES
# $(YACC_FILES) should be a list of .y files
# $(YACC_PP_FILES) should be a list of .y files
# bison_verbose = -v
$(srcdir)/%-yacc.h: $(srcdir)/%.y
touch $@
$(srcdir)/%-yacc.c: $(srcdir)/%.y
bison $(bison_verbose) -o $@ -d $<
$(srcdir)/%-yacc.cpp: $(srcdir)/%.y
bison $(bison_verbose) -o $@ -d $< && \
mv $(srcdir)/$*-yacc.hpp $(srcdir)/$*-yacc.h
ugly_yacc_sources = \
$(YACC_FILES:.y=-yacc.c) \
$(YACC_FILES:.y=-yacc.h) \
$(YACC_PP_FILES:.y=-yacc.cpp) \
$(YACC_PP_FILES:.y=-yacc.h)
BUILT_SOURCES += $(ugly_yacc_sources)
EXTRA_DIST += $(YACC_FILES) $(YACC_PP_FILES)
@MODULE@_SOURCES += $(ugly_yacc_sources)