How to use automake to generate a Makefile

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rpjanaka
    New Member
    • Oct 2006
    • 10

    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=voi d -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=voi d -DHAVE_SIGACTION =1
    LIBS = -lpthread


    bin_PROGRAMS = igi_server igi_client


    igi_server_SOUR CES = nbs_server.c nbs_setsignal.c
    igi_server_LDAD D = $(LIBS)
    igi_server_CFLA GS = -g -Wall $(DEFS) $(INCS)


    igi_client_SOUR CES = nbs_setsignal.c nbs_client.c nbs_client_test .c
    igi_client_LDAD D = $(LIBS)
    igi_client_CFLA GS = -g -Wall $(DEFS) $(INCS)
    *************** *************** *************** *************** *****

    the configure.in file is as follow.
    *************** *************** *************** *************** *****
    AC_INIT(igi_ser ver.c)
    AM_INIT_AUTOMAK E(igi_server, 1.0)
    AC_PROG_CC
    #indicate where to create make files
    AC_OUTPUT(Makef ile)
    *************** *************** *************** *************** *****

    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.
  • rpjanaka
    New Member
    • Oct 2006
    • 10

    #2
    I just able to fix the bug, but unfortunately I can not explain the reasons for it.

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

    DEFS = -DLINUX -DRETSIGTYPE=voi d -DHAVE_SIGACTION =1
    LIBS = -lpthread



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



    bin_PROGRAMS = igi_server igi_client


    igi_server_SOUR CES = nbs_server.c nbs_setsignal.c
    igi_server_LDAD D = $(LIBS)

    igi_client_SOUR CES = nbs_setsignal.c nbs_client.c nbs_client_test .c
    igi_client_LDAD D = $(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.

    Comment

    Working...