Jam - Using a single target in multiple directories

Sometimes, desire to use an object file in multiple directories arises. Assume the following directory structure.

  • src/common/tests
  • src/unittest

A test in common/tests need only one object in unittest to be linked, but one does not want to make it as a library for that.

Jam - Cross referencing between directories

Assume the following directory structure.

  • src
  • src/common
  • src/common/tests

Of course, common/tests includes common for testing. Problem is when one wants to include common/tests from common, say, to make tests runnable from common directory. Simply SubIncludeing each other result in infinite recursion, and does not work .

Using Jam

Originally, I was willing to write “Introduction to Jam”. But Jam documentation seems to do the job quite well already, so I’ve changed my plan to write some important things as I remember. This document does not cover most syntax and rules and is not for first learners. It contains an overview of very basic concepts and quite detailed problems

Hello, world!

Make Jamfile. In simple case, the following one line is enough.

Main hello : hello.c ;

Run jam.

$ jam

Counting variadic arguments

The following code is simplified version of a code snippet which I’ve found on stack overflow site.

#define VA_COUNT(…) VA_COUNT0(__VA_ARGS__, 9, 8, 7, 6, 5, 4, 3, 2, 1)
#define VA_COUNT0(_1, _2, _3, _4, _5, _6, _7, _8, _9, N, …) N

Being able to count at preprocessing stage, means many things.
There’re a bunch of subtle, dirty expressions related to variadic macro or function in C.

Setting subtheme CSS

Font size too big for a title with a link.

It’s because there are 30% increase by both .title and .title a. So, font size of a title and that of a link in a title differs. In order not to increase another 30% at a link in a title, add the following code to CSS.

.title a {
  font-size: 1.0em;
}

Creating subtheme

Until recently I was satisfied with the bluemarine theme, but now a few problems bothers me.

  1. Font size is too big for book titles in the book outline of the left sidebar menu.
  2. It’s rather difficult to distinguish h1 and h2 in contents.
  3. On chrome, font size of inlined code is smaller than on IE. (Block-level codes have the same problem when GeSHi filter is set to GESHI_HEADER_DIV, not GESHI_HEADER_PRE.)

I tried to solve those problems with the previously created module’s CSS. But it can’t override theme’s CSS because it’s placed after other modules’ CSS’s but before theme’s CSS. So, I had to follow the standard procedure by creating subtheme. I was somewhat afraid of spending too much time, but creating subtheme itself was very easy.

Multi-language setting - i18n

Configuring Internationalization

After configuring core modules only, pages like front page (=/node, by default) or blog page (=/blog) show original and translated contents mixed. The i18n module solves this problem. Additionally, you can set up some details like prohibiting language neutral contents.

Multi-language setting - locale, translation

After setting ads, I thought that, being rarely known site, perhaps English content might be (at least slightly more) advantageous for exposure to the search engines. And as I remembered that I’d encountered with related topics in drupal documentations, I decided to set up a multilingual site supporting both Korean and English.

During this process, I’ve spent time longer than expected, and had to see the sources of drupal modules. I succeeded to set up a multilingual site, but failed to adjust a few details because of some bugs. Here I summarize it.

Overriding CSS

(Update) Later, switched to creating a subtheme because of a limitation of this method

Looked around, and it looks fine mostly, except that those double border around codes displayed by GeShi filter. Using chrome’s “Developer tools” (which actually was my first experience, and it seems like it’s great and indispensable tool for creating homepage), I found that it is made up of <div class="geshifilter">, <pre>, in that order, and

  1. geshifilter defines the border of div.geshifilter,
  2. drupal theme defines the border of pre,

so, it become double bordered.

Creating custom module!

Couldn’t resist, so I decided to solve the annoying problems. As I’m newbie to drupal, it took some time, but not long.

Prerequisites:

  • Drupal modules basically works by defining hooks.
  • Execution order of different modules is determined by their weights.

That is, you can override results of other modules without modifying them by defining a module with bigger weight. Actually, many sites seems to be constructed that way, to minimize inconvenience during upgrade.

Syndicate content