<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Damien Lespiau &#187; misc</title>
	<atom:link href="http://damien.lespiau.name/blog/category/misc/feed/" rel="self" type="application/rss+xml" />
	<link>http://damien.lespiau.name/blog</link>
	<description>errands</description>
	<lastBuildDate>Sat, 17 Sep 2011 00:37:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>A simple autotool template</title>
		<link>http://damien.lespiau.name/blog/2011/09/17/a-simple-autotool-template/</link>
		<comments>http://damien.lespiau.name/blog/2011/09/17/a-simple-autotool-template/#comments</comments>
		<pubDate>Sat, 17 Sep 2011 00:25:52 +0000</pubDate>
		<dc:creator>damien</dc:creator>
				<category><![CDATA[misc]]></category>

		<guid isPermaLink="false">http://damien.lespiau.name/blog/?p=249</guid>
		<description><![CDATA[Every now and then, you feel a big urge to start hacking on a small thingy and need to create Makefiles for it. Turns out that the autotools won&#8217;t be that intrusive when we are talking about small programs and you get do a reasonable job with a few lines, first the configure.ac file: # [...]]]></description>
			<content:encoded><![CDATA[<p>Every now and then, you feel a big urge to start hacking on a small thingy and need to create Makefiles for it. Turns out that the autotools won&#8217;t be that intrusive when we are talking about small programs and you get do a reasonable job with a few lines, first the <code class="filename">configure.ac</code> file:</p>
<pre># autoconf
AC_PREREQ(2.59)
AC_INIT([fart], [0.0.1], [damien.lespiau@gmail.com])
AC_CONFIG_MACRO_DIR([build])
AC_CONFIG_AUX_DIR([build])
AC_CONFIG_SRCDIR([fart.c])
AC_CONFIG_HEADERS([config.h])

# automake
AM_INIT_AUTOMAKE([1.11 -Wall foreign no-define])
AM_SILENT_RULES([yes])

# Check for programs
AC_PROG_CC

# Check for header files
AC_HEADER_STDC

AS_COMPILER_FLAGS([WARNING_CFLAGS],
		  ["-Wall -Wshadow -Wcast-align -Wno-uninitialized
		   -Wno-strict-aliasing -Wempty-body -Wformat -Wformat-security
		   -Winit-self -Wdeclaration-after-statement -Wvla
		   -Wpointer-arith"])

PKG_CHECK_MODULES([GLIB], [glib-2.0 &gt;= 2.24])

AC_OUTPUT([
  Makefile
])</pre>
<p>and then <code class="filename">Makefile.am</code>:</p>
<pre>ACLOCAL_AMFLAGS = -I build ${ACLOCAL_FLAGS}

bin_PROGRAMS = fart

fart_SOURCES =	fart.c
fart_CFLAGS  = $(WARNING_CFLAGS) $(GLIB_CFLAGS)
fart_LDADD   = $(GLIB_LIBS)</pre>
<p>After that, it&#8217;s just a matter of running <code class="command">autoreconf</code></p>
<pre>$ autoreconf -i</pre>
<p>and you are all set!</p>
<p>So, what do you get for this amount of lines?</p>
<ul>
<li>The usual set of automake targets, handy! (&#8220;make tags&#8221; is so under used!) and bonus features (out of tree builds, extra rules to reconfigure/rebuild the Makefiles on changes in configure.ac/Makefile.an, &#8230;)</li>
<li>Trying to make the autoconf/automake discreet (putting auxiliary files out of the way, silence mode, automake for non GNU projects)</li>
<li>Some decent warning flags (tweak to your liking!)</li>
<li>autoreconf cooperating with aclocal thanks to ACLOCAL_AMFLAGS and coping with non standard locations for system m4 macros</li>
</ul>
<p>I&#8217;ll maintain a <a title="A simple autotool template" href="http://git.lespiau.name/cgit/program-template-simple/">git tree</a> to help bootstrap my next small hacks, feel free to use it as well!</p>
]]></content:encoded>
			<wfw:commentRss>http://damien.lespiau.name/blog/2011/09/17/a-simple-autotool-template/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Per project .vimrc</title>
		<link>http://damien.lespiau.name/blog/2009/03/18/per-project-vimrc/</link>
		<comments>http://damien.lespiau.name/blog/2009/03/18/per-project-vimrc/#comments</comments>
		<pubDate>Wed, 18 Mar 2009 22:52:40 +0000</pubDate>
		<dc:creator>damien</dc:creator>
				<category><![CDATA[misc]]></category>

		<guid isPermaLink="false">http://damien.lespiau.name/blog/?p=110</guid>
		<description><![CDATA[My natural C indentation style is basically kernel-like and my ~/.vimrc reflects that. Unfortunately I have to hack on GNUish-style projects and I really don&#8217;t want to edit my ~/.vimrc every single time I switch between different indentation styles. Modelines are evil. To solve that terrible issue, vim can use per directory configuration files. To [...]]]></description>
			<content:encoded><![CDATA[<p>My natural C indentation style is basically kernel-like and my <code class="filename">~/.vimrc</code> reflects that. Unfortunately I have to hack on GNUish-style projects and I really don&#8217;t want to edit my <code class="filename">~/.vimrc</code> every single time I switch between different indentation styles.</p>
<p>Modelines are evil.</p>
<p>To solve that terrible issue, <code class="command">vim</code> can use per directory configuration files. To enable that neat feature only two little lines are needed in your <code class="filename">~/.vimrc</code>:</p>
<pre>set exrc			" enable per-directory .vimrc files
set secure			" disable unsafe commands in local .vimrc files</pre>
<p>Then it&#8217;s just a matter of writing a per project <code class="filename">.vimrc</code> like this one:</p>
<pre>set tabstop=8
set softtabstop=2
set shiftwidth=2
set expandtab
set cinoptions=&gt;4,n-2,{2,^-2,:0,=2,g0,h2,t0,+2,(0,u0,w1,m1</pre>
<p>You can find help with the wonderful <code>cinoptions</code> variable in the <a title="cinoptions documentation" href="http://vimdoc.sourceforge.net/htmldoc/indent.html#cinoptions-values">Vim documentation</a>. As sane persons open files from the project&#8217;s root directory, this works like a charm. As for the Makefiles, they are special anyway, you really should add an autocmd in your <code class="filename">~/.vimrc</code>.</p>
<pre>" add list lcs=tab:>-,trail:x for tab/trailing space visuals
autocmd BufEnter ?akefile* set noet ts=8 sw=8 nocindent</pre>
]]></content:encoded>
			<wfw:commentRss>http://damien.lespiau.name/blog/2009/03/18/per-project-vimrc/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Vim macro for change log entry in .spec files</title>
		<link>http://damien.lespiau.name/blog/2009/02/10/vim-macro-for-change-log-entry-in-spec-files/</link>
		<comments>http://damien.lespiau.name/blog/2009/02/10/vim-macro-for-change-log-entry-in-spec-files/#comments</comments>
		<pubDate>Tue, 10 Feb 2009 12:38:37 +0000</pubDate>
		<dc:creator>damien</dc:creator>
				<category><![CDATA[misc]]></category>

		<guid isPermaLink="false">http://damien.lespiau.name/blog/?p=28</guid>
		<description><![CDATA[Tired of writing this kind of lines by hand ? * Mon Feb 09 2009 Damien Lespiau &#60;damien.lespiau@xxxx.com&#62; 1.4.3 This vim macro does just this for you! nmap ,mob-ts :r!date +'\%a \%b \%d \%Y'&#60;CR&#62;0i* &#60;ESC&#62;$a Damien Lespiau &#60;damien.lespiau@xxxx.com&#62; FIXME]]></description>
			<content:encoded><![CDATA[<p>Tired of writing this kind of lines by hand ?</p>
<p><code>* Mon Feb 09 2009 Damien Lespiau &lt;damien.lespiau@xxxx.com&gt; 1.4.3</code></p>
<p>This vim macro does just this for you!</p>
<p><code>nmap ,mob-ts :r!date +'\%a \%b \%d \%Y'&lt;CR&gt;0i* &lt;ESC&gt;$a Damien Lespiau &lt;damien.lespiau@xxxx.com&gt; FIXME</code></p>
]]></content:encoded>
			<wfw:commentRss>http://damien.lespiau.name/blog/2009/02/10/vim-macro-for-change-log-entry-in-spec-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

