Re: Configuring Postgres to Add A New Source File - Mailing list pgsql-hackers

From Tareq Aljabban
Subject Re: Configuring Postgres to Add A New Source File
Date
Msg-id CAGOe0a+HMasoGAhyyeRDGEEmaa4VAUT6EtVMOaF1Rqw7Tjx8kQ@mail.gmail.com
Whole thread Raw
In response to Re: Configuring Postgres to Add A New Source File  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Configuring Postgres to Add A New Source File  (Robert Haas <robertmhaas@gmail.com>)
List 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@gmail.com> wrote:
On Wed, Jan 25, 2012 at 7:06 AM, Tareq Aljabban
<tareq.aljabban@gmail.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

pgsql-hackers by date:

Previous
From: Merlin Moncure
Date:
Subject: Re: CLOG contention, part 2
Next
From: Alvaro Herrera
Date:
Subject: Re: foreign key locks, 2nd attempt