help-make
[Top][All Lists]
Advanced

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

Makefile, src, obj's in different directories and dep to work


From: Frank
Subject: Makefile, src, obj's in different directories and dep to work
Date: Fri, 12 Sep 2003 15:55:58 -0400

I would like to have the makefile, the .cpp's and .o's all indifferent
directories instead of all jammed into one directory. I have an example
of some ones but am unable to see how to change it to work off different
directories (can't get decencies etc to work correctly or compile etc)



i.e.
#############################################################################

# The Makefile for the gtServ application
#############################################################################

SUBSYS = gtServ
PGM    = gtServ

all  :  $(PGM)
 echo $(PGM) is up to date.

clean :
 rm -f $(PGM) *.o

#############################################################################

# Open SSL INFO
#############################################################################

#
# include path needs both OpenSSL "snapshot" and install directories
# (not really sure if this is true anymore!)
#
SSL_SNAP=/tmp/openssl-SNAP-20030826
SSL_INC=/usr/local/ssl/include
SSL_INC_PATHS= \
    -I$(SSL_INC)  \
    -I$(SSL_SNAP)/include/openssl \
    -I$(SSL_SNAP)/include \
    -I$(SSL_SNAP)/crypto/ec

SSL_LIB_PATHS = -L/usr/local/ssl/lib
SSL_LIBS = -lcrypto -lssl

#
# CPP flags are
#       -pthread (for multi-threaded)
#       -g       (for debug (gdb enabled))
#       -v       (for verbose)
#       -lrt     (link with real-time libraries)
#
CPPFLAGS = -pthread -I$(SSL_INC_PATHS) -I$(KW_INC)
LDFLAGS  = -pthread -L$(KW_LIB) -lkwEc -lkwCommon $(SSL_LIB_PATHS)
$(SSL_LIBS)

SRC =    \
     gKeyNode.cpp \
     gMsg.cpp \
     gTree.cpp \
     gTreeNode.cpp \
     gtServ.cpp \
  gTreeTraverser.cpp \
     kwSocket.cpp \
     kwTcpSocket.cpp

OBJS = ${SRC:.cpp=.o}
DEPEND_LIBS = $(KW_LIB)/libkwCommon.a $(KW_LIB)/libkwEc.a

$(PGM) :  $(OBJS) $(DEPEND_LIBS)
 g++ -o $(PGM) $(OBJS) $(LDFLAGS)


##############################################################################

##########     Install Section
##############################################################################

#
# List all of this projects header files, libraries and binaries that
are
# to be copied to the KW_XXX areas (e.g., KW_INC, KW_LIB, etc.)
# For this subsystem, no headers or libraries are installed.
#
INSTALL_HDRS :
 @echo ${SUBSYS} project header and data files installed.

INSTALL_LIBS :
 @echo ${SUBSYS} project libraries installed.

INSTALL_PGMS : $(PGM)
 @copyIfNewer $(KW_BIN) $?
 @echo ${SUBSYS} project programs installed.


##############################################################################

##########     Dependency Section
##############################################################################

#
# **********                     IMPORTANT NOTE
**********
#
# You must run make depend at least one time before UNcommenting the
# following include line.  If you UNcommente the include line before
# running make depend, you will get an error indicating there is
# no rule to make target 'gtServ.dep'
#
include ${SUBSYS}.dep

depend :
 @echo "# DO NOT DELETE THIS LINE -- make depend depends on it." >
$(SUBSYS).dep.temp
 @makedepend -f $(SUBSYS).dep.temp -Y   -- $(CPPFLAGS)  $(SRC) 2>
/dev/null
 @fixDependFile KW_INC=$(KW_INC) SSL_SNAP=$(SSL_SNAP) SSL_INC=$(SSL_INC)
\
                $(SUBSYS).dep.temp > $(SUBSYS).dep
 @rm -f $(SUBSYS).dep.temp






reply via email to

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