Gentoo Development Guide

No Build System

Occasionally some really small packages are shipped simply as a single .c file. In these circumstances, you can either write your own Makefile and ship it with the source tarball, or just manually compile the thing from within the ebuild, preferebly explaining why. Here's an example, from app-misc/hilite:

src_compile() {
    $(tc-getCC) ${LDFLAGS} ${CFLAGS} -o ${PN} ${P}.c || die
}

Here's an example from x11-plugins/asclock, which ships with a broken build system that doesn't actually work:

src_compile() {
    local x
    for x in asclock parser symbols config
    do
        $(tc-getCC) \
            ${CPPFLAGS} ${CFLAGS} ${ASFLAGS} \
            -I/usr/include \
            -Dlinux \
            -D_POSIX_C_SOURCE=199309L \
            -D_POSIX_SOURCE \
            -D_XOPEN_SOURCE \
            -D_BSD_SOURCE \
            -D_SVID_SOURCE \
            -DFUNCPROTO=15 \
            -DNARROWPROTO \
            -c -o ${x}.o ${x}.c || die "compile asclock failed"
    done
    $(tc-getCC) \
        ${LDFLAGS} \
        -o asclock \
        asclock.o parser.o symbols.o config.o \
        -L/usr/lib \
        -L/usr/lib/X11 \
        -lXpm -lXext -lX11 || die "link asclock failed"
}

A possibly better alternative would be to patch the build system and send it upstream.