Re: Multiple .o files from single .c file - how?

From: Krzysztof Halasa (khc@intrepid.pm.waw.pl)
Date: Fri Apr 07 2000 - 03:48:44 EST


greyham@research.canon.com.au (Graham Stoney) writes:

> Krzysztof Halasa writes:
> > There are two cards which are almost identical but one of them uses
> > MMIO while the other uses regular IO. Of course, I'd like to have only
> > one copy of driver source code and I want two binary drivers which can
> > be selected and compiled independently.
>
> I believe the preferred approach is to split it into three modules: MMIO, IO
> and common stuff, where MMIO and IO depend on the module with the common
> stuff.

It's not practical - most of driver code use (MM)IO instructions, the
common part would be empty and both MMIO and IO modules would be
nearly identical.

It would be best to:
        gcc -DUSE_MMIO driver.c -o driver-mmio.o
and
        gcc -DUSE_IO driver.c -o driver-io.o

but I don't now if there is a clean way to do it in Makefile(s).

Of course, having identical (link?) driver-mmio.c and driver-io.c would do.

-- 
Krzysztof Halasa
Network Administrator

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Apr 07 2000 - 21:00:18 EST