Previous Next Table of Contents

3. Setting up the source directory

The simplest way to create a module is by adding a subdirectory in the modules directory of the Linuxconf source tree. At some point, a development kit will be distributed containing only the required header file. But for now, use this avenue.

3.1 Creating the modules/your_module sub-directory

Create the sub-directory. In this directory, create a Makefile using one of the other modules Makefile as a template. Here is one for the mrtg module.

        CURDIR=mrtg
        LOCAL_CLEAN=std_local_clean
        LOCAL_INSTALL=std_local_install
        all: $(CURDIR).so
        OBJS =  mrtg.o mrtgedit.o _dict.o

        include ../rules.mak

        include ../stdmod.mak

        # Test program
        

3.2 Creating the _dict.cc file

Every module and every sub-directory in Linuxconf has such a file. It is very small. It is required by the translation system. Here is the one for the mrtg module. Copy this one and change the mrtg.m include for the name of the sub-directory for your module. As you see above, the _dict.o object is in the OBJS macro.

        #include "mrtg.m"
        #include <translat.h>
        DICTIONARY_REQUEST;
        

The translation system will be explained shortly later.

3.3 Updating modules/Makefile

If you expect your module to be recompiled and installed when one compile the Linuxconf project, you must update the modules/Makefile file and add the name of the sub-directory in the DIRS macro.


Previous Next Table of Contents