help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

makefile questions


From: Fred J.
Subject: makefile questions
Date: Tue, 14 Sep 2004 15:09:28 -0700 (PDT)

Hello

I have this makefile with a point or 2 that I would
like to understand, the question is 
prefixed with "**********"  with in some sections
bellow.
please also comments for improvments I could make to
the file.

thanks

# use "g++" to compile source file
CXX = g++

# the linker is also "g++"
LD = g++

# compiler flags go here
CXXFLAGS = -g -Wall

# linker flags go here "-s" to strip an optamized code
LDFLAGS = 
*********** can I leave this like that "= blank" for
future use?


# command to erase files
RM = /bin/rm -f

# list of objects
OBJS =  obj1.o obj2.o obj3.o main.o \
        ../libmyLib1.a \
        ../libmyLib2.a \
        /usr/lib/libboost_filesystem.a

********** I am not sure if this is correct, I mean
listing the full_path to each lib?
in main.cpp I have
#include
"/usr/include/boost/filesystem/operations.hpp" 
#include "/usr/include/boost/filesystem/fstream.hpp"
#include "/usr/include/boost/filesystem/path.hpp"
#include "obj1.h"
#include "obj2.h"
#include "obj3.h"
#include "../lib1.h"
#include "../lib2.h"

#list of libraries
LIBS = -lmyLib1 -lmyLib2 -lboost_filesystem

# program executable file name
PROG = prog

# top-level rule, to compile every thing
all: $(PROG)

# rule to link the program
$(PROG): $(OBJS)
        $(LD) $(CXXFLAGS) \
         -I.. -L.. \ #for all the .h(s) and .a(s) in the
working dir.
        -I/usr/include/boot/filesystem \
        -L/usr/lib \ #where libboost_filesaytem.a is
        $(OBJS) $(LIBS) -o $(PROG)
********* this section I have my doughts about

# cleaning up
clean:
        $(RM) $(PROG) *.o

# compiling rule
.o.cpp:
        $(CXX) $(CXXFLAGS) -c $<


        
                
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]