Re: Configuring Postgres to Add A New Source File

From: Tareq Aljabban <tareq(dot)aljabban(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Configuring Postgres to Add A New Source File
Date: 2012-01-27 23:37:38
Message-ID: CAGOe0a+HMasoGAhyyeRDGEEmaa4VAUT6EtVMOaF1Rqw7Tjx8kQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Indeed, I'm a beginner in "Make", but I read few tutorials and was able to
do what I wanted outside of PG using a simple make file.
Now, when moving to PG, I found the Make structure much more complicated
and didn't know where to add my configuration.
I'm looking only for this file to run in PG (the required functionality is
done already). My code will be a part of the backend, so I want to keep it
there.
You're saying it's going to be a bit tricky to do what I want with make (as
I'm novice in it).. so can you please point out some references I can start
from?!
Do you think reposting this in the "novice" mailing list will be a good
idea?
Thanks

On Thu, Jan 26, 2012 at 12:54 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:

> On Wed, Jan 25, 2012 at 7:06 AM, Tareq Aljabban
> <tareq(dot)aljabban(at)gmail(dot)com> wrote:
> > Hi,
> > I'm doing some development on the storage manager module of Postgres.
> >
> > I have added few source files already to the smgr folder, and I was able
> to
> > have the Make system includes them by adding their names to the OBJS
> list in
> > the Makefile inside the smgr folder. (i.e. When I add A.c, I would add
> A.o
> > to the OBJS list).
> >
> > That was working fine. Now I'm trying to add a new file hdfs_test.c to
> the
> > project. The problem with this file is that it requires some extra
> > directives in its compilation command (-I and -L directives).
> >
> > Using gcc the file is compiled with the command:
> >
> > gcc hdfs_test.c -I/HDFS_HOME/hdfs/src/c++/libhdfs
> > -I/usr/lib/jvm/default-java/include -L/HDFS_HOME/hdfs/src/c++/libhdfs
> > -L/HDFS_HOME/build/c++/Linux-i386-32/lib
> > -L/usr/lib/jvm/default-java/jre/lib/i386/server -ljvm -lhdfs -o hdfs_test
> >
> > I was told that in order to add the extra directives, I need to modify
> > $LDFLAGS in configure.in and $LIBS in MakeFile.
> >
> > I read about autoconf and checked configure.in of Postgres but still
> wasn't
> > able to know exactly what I should be doing.
>
> This is really a general question about make that has nothing to do
> with PostgreSQL specifically; you might want to get a book on "make".
>
> Makefiles in subdirectories of src/backend are only intended to be
> able to build the backend itself, so there's probably no particularly
> easy way to do what you want there. You likely want to put this code
> someplace like src/test/hdfs_test and copy one of the other Makefiles
> into the new directory, perhaps src/test/isolation/Makefile.
>
> But even if you do that for starters, you're going to need to make
> some modifications, which may be a bit tricky if you have no
> experience at all using make.
>
> --
> Robert Haas
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2012-01-27 23:47:27 Re: foreign key locks, 2nd attempt
Previous Message Merlin Moncure 2012-01-27 23:16:57 Re: CLOG contention, part 2