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. Here's an example, from app-misc/hilite:

src_compile() {
    $(tc-getCC ) ${CFLAGS} -o ${PN} ${P}.c \
        || die "Compile failed!"
}

Here's an example from x11-plugins/gkrelltop, which ships with a Makefile that doesn't actually work:

src_compile() {
    CONFIG="-DLINUX -DGKRELLM2 -fPIC $(pkg-config gtk+-2.0 --cflags)"
    LIBS="$(pkg-config gtk+-2.0 --libs) -shared"
    OBJS="top_three2.o gkrelltop2.o"

    gcc -c $CONFIG $CFLAGS top_three.c -o top_three2.o || die
    gcc -c $CONFIG $CFLAGS gkrelltop.c -o gkrelltop2.o || die
    gcc $LIBS $CONFIG $CFLAGS -o gkrelltop2.so $OBJS || die
}

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