Hello,

I am exploring the tools on Plan 9 and I am having a problem
getting the correct files to be included.  My test setup is
that I have a directory with C source and headers.  In a sub-
directory, I have the plan 9 mkfile and a customized version
of one of the header files.  I would like the C compiler to
find my customized version of the header instead of the one
in the original source directory.

The desired results of running my test is:
cpu% cd source/plan9
cpu% mk
cpu% ./main
MSG = this is from plan9/inc1.h
MSG2 = this is from inc2.h
cpu%

However, everything I have tried results in:
cpu% ./main
MSG = this is from inc1.h
MSG2 = this is from inc2.h
cpu%

The files I am using for the test are:

source/
    inc1.h
    inc2.h
    main.c
    plan9/
        inc1.h
        mkfile


inc1.h:
#define MSG "this is from inc1.h"

inc2.h:
#define MSG2 "this is from inc2.h"

main.c:
#include <u.h>
#include <libc.h>

#include "inc1.h"
#include "inc2.h"

void
main (int argc, char *argv[])
{
        print ("MSG = %s\n", MSG);
        print ("MSG2 = %s\n", MSG2);

        exits (0);
}


plan9/inc1.h:
#define MSG "this is from plan9/inc1.h"

plan9/mkfile
</$objtype/mkfile

CFLAGS=-p -N -.
LDFLAGS=

main: main.$O
        $LD $LDFLAGS -o main main.$O

main.$O: ../main.c
        $CC $CFLAGS ../main.c

clean:V:
        rm -f main main.$O


I have tried many combinations of -N, -., -I., -I.., and nothing
seems to work.  I would expect that the above CFLAGS definition
would cause the compiler to not find either inc1.h or inc2.h.
However, even with CFLAGS=-p -N -., it finds both the header files
in source.

If I do not use the ANSI preprocessor, setting CFLAGS=-. -I. -I..
works.

I am running on a Plan 9 cpu server that I updated on May 18.

Any enlightenment would be appreciated.

Kim

Reply via email to