Build a library with Make.gfxtools.rules

This tutorial explains how to build a very simple library using the $G Makefiles. This library will have one .H file and one .cpp file. Put these in a directory with the Makefile specified below.
  1. edit "foo.H" and add the following lines:
    #ifndef FOO_H
    #define FOO_H
    
    bool isGreater(int a, int b);
    
    #endif
    
  2. edit "foo.cpp" and add the following lines:
    #include "foo.H"
    
    bool isGreater(int a, int b) {
      return (a > b);
    }
    
  3. edit "Makefile" and add the following lines:
    PROJECT_NAME=foo
    OBJDIR=obj
    
    H=foo.H
    
    SRC=foo.cpp
    
    # by default, build all versions of the library
    all:   libg libo libp
    
    # rule to compile the debug version
    debug: libg
    
    # rule to compile the optimized version
    opt:   libo
    
    # rule to compile the profiling version
    prof:  libp
    
    include $(G)/lib/Make.gfxtools.rules
    -include Makefile.depend
    
  4. make all