Thread: Makefiles

  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Cape Town, South Africa
    Rep Power

    Question Makefiles

    I would just like to know how this works:
    how is it possible to compile a .c file (in this case loginsert.c) with the other logfilter_rule* files in the resulting binaries. What is the purpose if no reference to any of the functions has been made in the loginsert.c file (even though it appears the previous programmer has been able to make use of them). I grepped through the files and nowhere is there a reference to any of the functions in logfilter_rule_domain.c. I have the unenviable task of unravelling the previos programmers uncommented code and finishing his work off for him. That and I am fresh out of university with just a year of C++ behind me. I have a basic understanding of linux at the moment and the program that I am 'finishing off' is being run on FreeBSD. Any help would be greatly appreciated...
    Here is the makefile:
    CFLAGS=-I../include -I/usr/local/include
    LDFLAGS=-L/usr/local/lib -lpq -lm
    FILTER_RULES=logfilter_rule.o \
    logfilter_rule_user.o \
    logfilter_rule_domain.o \
    logfilter_rule_sourceip.o \
    logfilter_rule_dow.o \
    logfilter_rule_time.o \

    all: logconvert loginsert

    logconvert: logconvert.o logcut.o

    loginsert: loginsert.o tokenizer.o logconf.o logfilter.o logutil.o logcut.o logcache.o $(FILTER_RULES)

    install: all
    cp logconvert loginsert /usr/local/bin

    rm -f logconvert loginsert *.o
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2002
    Flint, MI
    Rep Power
    There are a couple of things that might help you out. First, practice with written English a little more. Your message took some deciphering. Second, you'll want to read up on Makefiles a little bit. If you're working in FreeBSD you'll need to use them a lot.

    The problem with your Makefile is that you don't have any instructions for the loginsert target, only a list of dependencies. In theory you want to link all of those object files together into an executable. That might be as simple a rule as $(CC) your dependencies here. I don't have enough information to go on based on what you've posted. That's why you should check out the man page on make. You might also want to hunt for articles on the web.
    Clay Dowling
    Lazarus Notes
    Articles and commentary on web development

IMN logo majestic logo threadwatch logo seochat tools logo