468,513 Members | 962 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,513 developers. It's quick & easy.

How to use automake to generate a Makefile

I am using an open source library called IGI_UDP for measure the available bandwidth of a link (http://www.cs.cmu.edu/%7Ehnn/igi/ ).
with that library they have provided a "Makefile" which is not an auto generated one.

the following is the given Makefile,

************************************************** ***************
CC = gcc
INCS = -I.
CFLAGS = -g -Wall $(DEFS) $(INCS)

# for linux
DEFS = -DLINUX -DRETSIGTYPE=void -DHAVE_SIGACTION=1
LIBS = -lpthread


CLIOBJS = nbs_setsignal.o nbs_client.o nbs_client_test.o
SRVOBJS = nbs_setsignal.o nbs_server.o

.c.o:
@rm -f $@
$(CC) $(CFLAGS) -c $*.c

all: igi_server igi_client

igi_client: $(CLIOBJS)
@rm -f $@
$(CC) $(CFLAGS) -o $@ $(CLIOBJS) $(LIBS)

igi_server: $(SRVOBJS)
@rm -f $@
$(CC) $(CFLAGS) -o $@ $(SRVOBJS) $(LIBS)

clean:
rm -f *.o igi_client igi_server
************************************************** ***************


But now I want to generate this Makefile through the automake tool (for using with my application)
So that I created the following Makefile.am file


************************************************** ***************
CC = gcc
INCS = -I.


# for linux
DEFS = -DLINUX -DRETSIGTYPE=void -DHAVE_SIGACTION=1
LIBS = -lpthread


bin_PROGRAMS = igi_server igi_client


igi_server_SOURCES = nbs_server.c nbs_setsignal.c
igi_server_LDADD = $(LIBS)
igi_server_CFLAGS = -g -Wall $(DEFS) $(INCS)


igi_client_SOURCES = nbs_setsignal.c nbs_client.c nbs_client_test.c
igi_client_LDADD = $(LIBS)
igi_client_CFLAGS = -g -Wall $(DEFS) $(INCS)
************************************************** ***************

the configure.in file is as follow.
************************************************** ***************
AC_INIT(igi_server.c)
AM_INIT_AUTOMAKE(igi_server, 1.0)
AC_PROG_CC
#indicate where to create make files
AC_OUTPUT(Makefile)
************************************************** ***************

By using this Makefile.am and configure.in, I can just compile the sources and create the executables. But the problem is those compiled code does not give the expected result (it is highly differ form when it is used the previous Makefile)

It is obvious that the problem is with my Makefile.am file or configure.in, (I guess that required macro has not been used)
So please can anyone help me to create the proper Makefile.am file and configure.in file.
Feb 15 '08 #1
1 4755
I just able to fix the bug, but unfortunately I can not explain the reasons for it.

new Makefile.am
************************************************** ******************************

DEFS = -DLINUX -DRETSIGTYPE=void -DHAVE_SIGACTION=1
LIBS = -lpthread



CFLAGS = -g -Wall $(DEFS) $(INCS)



bin_PROGRAMS = igi_server igi_client


igi_server_SOURCES = nbs_server.c nbs_setsignal.c
igi_server_LDADD = $(LIBS)

igi_client_SOURCES = nbs_setsignal.c nbs_client.c nbs_client_test.c
igi_client_LDADD = $(LIBS)


************************************************** ******************************

I suggest that the main reason for this is the line
CFLAGS = -g -Wall $(DEFS) $(INCS)

Please if anyone know the reason, you are highly appreciate.
Feb 16 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Bryan Olson | last post: by
2 posts views Thread by Magnus Therning | last post: by
2 posts views Thread by Juhan Voolaid | last post: by
6 posts views Thread by jpetrang | last post: by
4 posts views Thread by Jess | last post: by
1 post views Thread by wingri | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.