hello today I want to do a screencast on
how you can create a simple sea based
project with Auto tools sometimes this
can seem rather daunting and the
material online is a bit overwhelming
for something simple if you want to just
something to start with copying and
pasting the odd of tools configuration
files from other projects can create
configurations that are a bit too
complicated to understand for the
beginner so I kind of like to start
simple and start from scratch
unfortunately there's a rather simple
way to do that so the first thing I do
is I create a project directory and I'll
call this first gtk this will eventually
be a little gtk program and then inside
that we're gonna create several sub
directories I like one for my source
code for my tests my builds and then we
make a m4 directory this will get used
by Auto tools that is the new paradigm
now to output m4 macros inside that you
don't need to know about that now so
don't worry about it and then inside the
source directory we're going to create a
little hello world program main
include studio and painted ark see char
star
turn okay there we go
and we'll just make sure that compiles
cleanly which it does so that's kind of
our structure to start let's take a look
at it graphically here we have a
directory called first edk which is our
project directory in that we have
several sub directories build and for
source and test currently we only have
in the source directory they may not see
file the option file we don't need that
that was just to make sure we compiled
cleanly and that's where we start so the
next thing that I do is I create a in
Auto make file automic file is created
and the root of your project in this
case our first gtk folder right and we
go make file dot a and for auto make and
the only thing that there's a couple
lines that we need to start this with
one is the bin programs command or
directive and this names the executables
that are going to be created and put
into the bin directory usually user bin
upon make install when you install your
application and we're gonna call this
first gtk saves our project then the
next one is we're going to identify the
source files for this project
so first gtk which is the name of our
executable right here
so that starts with that and then
underscore all caps sources and here we
delineate all the source files that
relate or required to compile that
program and to start we're just going to
use our main dot C file now notice that
I did this back slash here this file is
intended to be a one-line and in order
to extend it across multiple lines you
have to escape with a new line and we do
that by hitting the backslash
immediately followed by a new line or
the amp Turkey that way we can do
multiple files like this also as we add
files to this our headers will call here
as well so for instance another each
last line does not need to have an
escape to new line so for now all we
need
is that right there okay so we've
defined what our executable is going to
be and we've defined what the source
files are gonna be all right from here
we can actually create the configure a
see template and that's beauty is
provided for us to do that called Auto
scan so we type a lot of scan and run
that this creates two files one is a log
file which as you can see is empty here
if there are errors or other print
information it'll be printed there but
we don't need that for it and then the
other is this configured out scan this
is our template if we take a look at
that
we'll see various generic information is
put here and this is precisely why I
like to use this because I don't
remember all these things this is a good
starting Sparta starting spot and this
is the minimum essentially required to
create a little Auto Tools program
the thing is that configure dot scan
isn't the proper name we need to change
that to configure it out AC so we'll go
ahead and do that
figure it out scan to configure DC so we
need to make some customizations to that
so let's do that they're gonna have a
couple of lines here and we're gonna
name this first gtk and we'll give it a
little version number this is all
arbitrary information not gonna do any
bug bug reports and then finally to use
Auto config with or Auto Kampf with Auto
make you need to tell Otto Kahn for that
you're gonna do that and the way to do
that is to add a line here called a.m.
for auto make in it so make a couple
parameters here we're gonna enable all
warnings and warnings to be errors now
notice that looks very similar to
compiler switches but in fact they have
nothing this has nothing to do with the
Pilar this is for auto make itself so it
will enable all warnings for auto make
and if ought to make generates any
warnings they will in fact to be
upgraded to errors if you and the final
little command we give here earth
directive is foreign and foreign will
set this project to be a foreign project
at least is from a perspective of good
new people in a good new project you
need certain files that you have to have
as part of your project like a readme
file and by using form we make it so
that that won't generate a warning or an
error
and that's all we need to integrate
automate with us so there we go we take
a look again we have our structure here
one source file called may not see we
have a configure a see which was
generated by Auto scan we tweaked it a
little bit with the name of our project
and integrated automate with this line
and we created a little automate file
which defined our executable name and
the sources required to generate that
executable okay now any time you modify
or create the configure a see and with
certain modifications sometimes of the
make file am you have to reconfigure the
auto conf system and fortunately there's
a simple command to do that it's called
auto recount so Auto reconfigure if you
own the auto comm systems and I like to
add a deeper both switch and the switch
and the I switch if we look here
actually if we look at the mana page the
ice which says install copy missing
auxiliary files and these auxiliary
files are used by the auto tools to
perform things like install files and
supplementary files for compilation and
stuff so you you want that happen and it
never hurts to essentially always use
those switches every time - me - I or
just - VI
now there's a interesting thing here we
have an error warning from how to make
warnings of treaties or errors and our
warning is that source may not cease in
a subdirectory but options sub der
objects' is disabled now in a future
version of Auto make subjects is going
to be enabled by default but for
backwards compatibility reasons this is
currently disabled in the old day is
traditionally every directory had its
own auto make configure system setup for
it and you had something called
recursive make and all this
some people believe that's not the best
way to do it and it's no longer really
required now the only downside is you
have to specify your files with a full
relative path if you will so instead of
just may not see its source slash may
not see this allows us to do easily do
out of three builds which I believe to
be an important feature and all I'll
show you more about that anyway how do
we get rid of this morning well we have
to enable this option Sumter objects the
way we do that is we edit our make file
die a.m. we adhere Auto make options
Subterra objects that's it and like I
said at some point we won't even need to
do that at all
that'll be just default setting for
automatically so let's rerun our Auto
let's see what ok so just look we have
errors but with this interesting
statement here unn escaped left brace
and regex
is deprecated what is this well turns
out this actually isn't an auto comm for
auto make error this is a warning from
pearl pearl is used apparently by Allah
for Allah make for some of its
processing and more recent versions of
pearls have decided that in unescape
left brace like this is deprecated and
in the future may actually turn into an
error I imagine this is due to some
parsing and the queue ities and a part
of the pearl in any case this is this is
a a you know a benign warning from Pearl
and in a future version of auto make I
imagine this particular one now you see
the line 3 9 3 6 this will be fixed and
will go away so for now if you see this
this particular kind of warning or or
statement can be safely ignored so that
means that our auto recall has been
successful so what is auto recap do well
primary thing that it does for us that
we concerned about immediately is it
creates this configure and if you've
ever installed anything from downloaded
software from the internet a common
paradigm is to run a configure and then
make and then make install well as you
can see it's configure programs rather
large 145 K in fact if we look at it
you'll see that it's quite large here
many many lines I mean I don't know
lionesses thousands maybe 5,000 and this
used to be written by hand are largely
by hand in the old days both point of
auto tools it largely is to automate
that process for systems so that we
don't have to do that and that's great
that's wonderful
no we don't want to have to worry about
that also
it created some supplementary auxilary
files they call it the step compas
install Osage missing compile AC local
etc and we don't need to be concerned
about those but the auto tools will use
them as it sees fit
so once configure is made or once we
have a successful auto recall we can
actually go into our built directory and
now we can run configure the important
point here is that I'm running configure
from the build directory I'm not in the
project directory directly the reason is
I don't like to pollute the project
directory with all the build stuff
there's enough stuff and there already I
don't want to pollute it with what I'm
about to temporarily are automatically
generated files so I do that in a film
director it doesn't have to be a
subdirectory I have a subdirectory here
but it could just as easily been of
directory at the same level I could have
had some other build directory here and
in fact some IDs well will do their
builds in this fashion
the point is that not doing it directly
here but in some other directory be in a
subdirectory or outside the structure
has useful benefits that you should
adhere to so we're gonna run configure
now and since the configure is in the
parent directory I need to give it a
double dot configure never don't
so what configure does is it makes a
make file I mean it does other things
but the primary thing that were
concerned about is it does this right
here it makes this make file and if if
we look at that make file we'll see that
again it's another rather large file
again this this used to have to be made
by hand and II for such a simple project
we couldn't make a very simple make file
that doesn't have all this these
features but what's nice here is that
this will operate on many different
types of UNIX systems even Windows and
we didn't have to write any of this and
that's a wonderful thing this is also
auto-generated and we can make simple
changes to make file dot a.m. and it
will automatically generate all of this
stuff for us well okay we have a make
file what can we do with it well the
primary thing we do with it is technique
that will compile and create our
executable and now we see it right there
for stretchy first up gtk and we can run
that
and there we go we have our hello world
the nice thing about a and make make or
any dependency build system is that if
you make changes to a file only the
files that are depend on it
need to be recompiled it keeps track of
all that that's what a that's what a
make file was originally for and all
build systems by and large do this
including Visual Studio C make which is
becoming the probably the most popular
in the UNIX space so an example of that
would be if I edit or modify our source
final source may not see and let's just
make change errors so let's add another
statement wasn't this
save that and now all I need to do here
is type making it and it knows that that
the C file change which means it needs
to recompile the executable and in fact
it really compelled it and a free run it
first okay we'll see now we also have
the wasn't this fun line alright just a
quick recap in order to create a basic
auto tools project you create a project
directory you can make some
supplementary files source test build
create a source file start simple create
an auto make and file and in that you
only need to mention your executable
name and the source file you've created
once you've done that go to the root of
your structure and type in auto recall -
VI will generate a configure script from
there
you can go out your bill directory run
that configure script that will generate
your make file and then you can type
make and that's all there is to it
you do get other things like make clean
make install etc I hope this was helpful
the next screencast will talk about how
we actually integrate gtk with our auto
tools built system