Root in Simple KDE App

Alexander Dymo adymo at
Mon Jun 7 22:09:09 UTC 2004

On Monday 07 June 2004 08:48, Steven T. Hatton wrote:
> If anybody cares to annotate the file reproduce below, it would probably be
> valuable for future reference. I've added my questions as comments.  I'll
> do what I can to answer these myself.  The Autotools documentation seems a
> bit inconsistent between different tools, and different versions can have
> important differences which change the meaning of things.  It gets rather
> confusing.
> #<project-root>/ created by the C++ Simple KDE Application
> template
> # What is the purpose of this file?  Where is the documentation for this
> kind # of file?
> # Where is the value of TOPSUBDIRS assigned.  When is this expression
> # evaluated? What does SUBDIRS mean, and what purpose does it serve? What
> # value will it have?
SUBDIRS is a list of directories to run recursive make in.
$(TOPSUBDIRS) is a variable evaluated by ./configure and represents a list of
directories for make. 
First ./configure saves a list of subdirectories in top source directory - 
$top_srcdir and saves a list of subdirs in $top_srcdir/subdirs file.
Then it looks for $top_srcdir/inst-apps file to check whether a 
particular subdir from $top_srcdir/subdirs should be compiled and installed.
Basically all valid directories listed in $top_srcdir/inst-apps are compiled
and installed (by "compiled" and "installed" i mean that make and make install
will be run).
The list of exceptions should be set in $DO_NOT_COMPILE variable.
You can set it in (for KDE projects) and in (for
other automake projects).
More information: info:/automake/Top level
You can also list subdirectories by hand in SUBDIRS variable like
SUBDIRS=foo1 foo2 foo3

> # Where is top_srcdir defined? What will its value be? How shoud the
> # expression be read?
$top_srcdir is a usual shell variable evaluated by configure (note that
configure is a simple shell script and are shell scripts with
m4 macro calls).
$top_srcdir usually evaluates as a directory where ./configure exists
and it is a top source directory.
Additional check to determine if the directory is source directory is done if
you specify AC_CONFIG_SRCDIR macro in

> $(top_srcdir)/ $(top_srcdir)/subdirs
> 	cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common ;
This rule applies for KDE projects which generate which is
needed by autoconf from your template - and
common KDE template - admin/

> # What happens here?
> $(top_srcdir)/subdirs:
> 	cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common subdirs
Don't know for sure.

> # What are acinclude.m4 and /admin/ ?
> # What happens in this step of processing?
> $(top_srcdir)/acinclude.m4: $(top_srcdir)/admin/
acinclude.* files contain macro definitions which will be expanded to
shell code by autoconf when it creates ./configure script.
admin/ contains macroses common for all KDE programs.
Common macroses from admin and your own (if specified in
$top_srcdir/ are collected together into $top_srcdir/acinclude.m4.
When aclocal runs it collects all system macroses and local ones from
$top_srcdir/acinclude.m4 to aclocal.m4.
More information: info:/autoconf/Making configure Scripts

> #  What happens here?  What does `@cd' mean?
> $(top_srcdir)/admin/
> 	@cd $(top_srcdir) && cat admin/ admin/ > \
> acinclude.m4
The collection of files into one acinclude.m4 as I described above.
In simple KDE template there are no "own" files and only default 
KDE macroses and libtool related ones go into acinclude.m4.
For explanation of @ see below.

> #What is assigned to MAINTAINERCLEANFILES, and how is it used?
> MAINTAINERCLEANFILES = subdirs acinclude.m4 configure.files
Look at info:/automake/maintainer-mode

> #What is package-messages?  A command? A label? A variable? What is
> `merge'? #What happens when this is evaluated?
> package-messages:
> 	cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common package-messages
> 	$(MAKE) -C po merge
It's a make rule.
The rule looks like:
target: dependencies
Commands can be any shell commands. If a command is prepended by a @
the command itself is not displayed.
Example makefile:
        @echo "boo"
Results of make:
Example makefile:
        echo "boo"
Results of make:
echo "boo"

Make started without arguments takes first target in makefile and executes all
commands first for dependent targets and then commands for this rule.
More information: info:/make/Introduction

So in that line package-messages is a target and everything else is a shell
command which is considered as an action to "build" the target.
 	$(MAKE) -C po merge
is an instruction to run $(MAKE) in directory po and build a target merge
defined in po/Makefile.
More information: info:/make/Options Summary

> # These are additional files beyond what is processed as source or part of
> the # build system.
> # What is this step?  What is am_edit? `-padmin'? top_distdir?
> dist-hook:
> 	cd $(top_distdir) && perl admin/am_edit -padmin
> 	cd $(top_distdir) && $(MAKE) -f admin/Makefile.common subdirs
admin/am_edit expands the specialised KDE tags in like 
METASOURCES, KDE_ICON, kde_module etc.
You may consider am_edit as a program which recognizes
KDE-based extentions to syntax which are not supported by

Alexander Dymo
ICST Department, National University of Shipbuilding, Mykolayiv, Ukraine

More information about the KDevelop-devel mailing list