2002-04-02 14:58:18 +08:00
|
|
|
|
|
|
|
default : opt
|
|
|
|
|
|
|
|
opt : $(EXEC:=.opt)\
|
|
|
|
$(LIB:=.opt)\
|
|
|
|
$(PLUGIN:=.opt)\
|
|
|
|
|
|
|
|
debug : $(EXEC:=.dbg)\
|
|
|
|
$(LIB:=.dbg)\
|
|
|
|
$(PLUGIN:=.dbg)\
|
|
|
|
|
|
|
|
cleanlite : cleanliteopt cleanlitedbg
|
|
|
|
|
|
|
|
cleanliteopt :
|
|
|
|
@[ -d $(OPTDIR) ] && cd $(OPTDIR); rm -f $(EXEC) $(LIB) $(PLUGIN)
|
|
|
|
|
|
|
|
cleanlitedbg :
|
|
|
|
@[ -d $(DEBUGDIR) ] && cd $(DEBUGDIR); rm -f $(EXEC) $(LIB) $(PLUGIN)
|
|
|
|
|
|
|
|
clean : cleanopt cleandbg
|
|
|
|
|
|
|
|
cleanopt :
|
|
|
|
@[ -d $(OPTDIR) ] && cd $(OPTDIR); rm -f $(OBJS) $(MAKEDEPEND)
|
|
|
|
|
|
|
|
cleandbg :
|
|
|
|
@[ -d $(DEBUGDIR) ] && cd $(DEBUGDIR); rm -f $(OBJS) $(MAKEDEPEND)
|
|
|
|
|
|
|
|
clobberopt :
|
|
|
|
rm -rf $(OPTDIR)
|
|
|
|
|
|
|
|
clobberdbg :
|
|
|
|
rm -rf $(DEBUGDIR)
|
|
|
|
|
|
|
|
clobber : clobberdbg clobberopt
|
|
|
|
|
|
|
|
|
|
|
|
beautify :
|
|
|
|
for f in *.cpp ; do mv $$f $$f.bak; bcpp $$f.bak $$f; rm $$f.bak; done
|
|
|
|
for f in *.h ; do mv $$f $$f.bak; bcpp $$f.bak $$f; rm $$f.bak; done
|
|
|
|
|
|
|
|
docs:
|
|
|
|
[ "$(TARGET_BASENAME)" != "" ] && \
|
|
|
|
mkdir -p $(TOPDIR)/doc/doc++/$(TARGET_BASENAME) && \
|
|
|
|
doc++ -d $(TOPDIR)/doc/doc++/$(TARGET_BASENAME) -H -A \
|
|
|
|
$(TOPDIR)/include/$(TARGET_BASENAME)/* && \
|
|
|
|
echo "$(TARGET_BASENAME) HTML documentation created in "\
|
|
|
|
"$(TOPDIR)/doc/doc++/$(TARGET_BASENAME)"
|
|
|
|
|
2002-04-05 09:52:15 +08:00
|
|
|
|
2002-04-02 14:58:18 +08:00
|
|
|
$(EXEC) : $(OBJS)
|
|
|
|
$(C++) $(LDFLAGS) $(OBJS) $(LIBS) -o $@
|
|
|
|
|
|
|
|
|
|
|
|
## Mac OSX makes the distinction between -dynamiclib and -bundle
|
|
|
|
## causing us to have to make a special case here, rather than
|
|
|
|
## just redefining the SHARED argument.
|
|
|
|
|
|
|
|
ifeq ($(OS),Darwin)
|
|
|
|
|
|
|
|
$(LIB) : $(OBJS)
|
|
|
|
$(C++) $(LDFLAGS) -dynamiclib $(OBJS) $(LIBS) -o $@
|
|
|
|
|
|
|
|
$(PLUGIN) : $(OBJS)
|
|
|
|
$(C++) $(LDFLAGS) -bundle $(OBJS) $(LIBS) -o $@
|
|
|
|
else
|
|
|
|
|
|
|
|
$(LIB) $(PLUGIN) : $(OBJS)
|
|
|
|
$(C++) $(LDFLAGS) $(SHARED) $(OBJS) $(LIBS) -o $@
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
$(EXEC:=.dbg) :
|
|
|
|
@[ -d $(DEBUGDIR) ] || mkdir $(DEBUGDIR)
|
|
|
|
@cd $(DEBUGDIR); \
|
|
|
|
$(MAKE) -f ../Makefile DOF=$(DBGF) TOPDIR=../${TOPDIR} \
|
2002-04-04 01:42:12 +08:00
|
|
|
THISDIR=../$(THISDIR)\
|
|
|
|
MAKEDEPEND=Makedepend $(EXEC)
|
2002-04-02 14:58:18 +08:00
|
|
|
@$(MAKE) LNSRC=$(DEBUGDIR)/$(EXEC) LNDEST=$(BININST)/$(EXEC) __link
|
|
|
|
|
|
|
|
$(LIB:=.dbg) :
|
|
|
|
@[ -d $(DEBUGDIR) ] || mkdir $(DEBUGDIR)
|
2002-04-04 01:42:12 +08:00
|
|
|
@cd $(DEBUGDIR);\
|
2002-04-02 14:58:18 +08:00
|
|
|
$(MAKE) -f ../Makefile DOF=$(DBGF) TOPDIR=../${TOPDIR} \
|
2002-04-04 01:42:12 +08:00
|
|
|
THISDIR=../$(THISDIR)\
|
|
|
|
MAKEDEPEND=Makedepend $(LIB)
|
2002-04-02 14:58:18 +08:00
|
|
|
@$(MAKE) LNSRC=$(DEBUGDIR)/$(LIB) LNDEST=$(LIBINST)/$(LIB) __link
|
|
|
|
|
|
|
|
$(PLUGIN:=.dbg) :
|
|
|
|
@[ -d $(DEBUGDIR) ] || mkdir $(DEBUGDIR)
|
|
|
|
@cd $(DEBUGDIR); \
|
|
|
|
$(MAKE) -f ../Makefile DOF=$(DBGF) TOPDIR=../${TOPDIR} \
|
2002-04-04 01:42:12 +08:00
|
|
|
THISDIR=../$(THISDIR)\
|
|
|
|
MAKEDEPEND=Makedepend $(PLUGIN)
|
2002-04-02 14:58:18 +08:00
|
|
|
@$(MAKE) LNSRC=$(DEBUGDIR)/$(PLUGIN) LNDEST=$(PLUGININST)/$(PLUGIN) __link
|
|
|
|
|
|
|
|
$(EXEC:=.opt) :
|
|
|
|
@[ -d $(OPTDIR) ] || mkdir $(OPTDIR)
|
|
|
|
@cd $(OPTDIR); \
|
|
|
|
$(MAKE) -f ../Makefile DOF=$(OPTF) TOPDIR=../${TOPDIR} \
|
2002-04-04 01:42:12 +08:00
|
|
|
THISDIR=../$(THISDIR)\
|
|
|
|
MAKEDEPEND=Makedepend $(EXEC)
|
2002-04-02 14:58:18 +08:00
|
|
|
@$(MAKE) LNSRC=$(OPTDIR)/$(EXEC) LNDEST=$(BININST)/$(EXEC) __link
|
|
|
|
|
|
|
|
|
|
|
|
$(LIB:=.opt) :
|
|
|
|
@[ -d $(OPTDIR) ] || mkdir $(OPTDIR)
|
2002-04-04 01:42:12 +08:00
|
|
|
@cd $(OPTDIR);\
|
2002-04-02 14:58:18 +08:00
|
|
|
$(MAKE) -f ../Makefile DOF=$(OPTF) TOPDIR=../${TOPDIR} \
|
2002-04-04 01:42:12 +08:00
|
|
|
THISDIR=../$(THISDIR)\
|
|
|
|
MAKEDEPEND=Makedepend $(LIB)
|
2002-04-02 14:58:18 +08:00
|
|
|
@$(MAKE) LNSRC=$(OPTDIR)/$(LIB) LNDEST=$(LIBINST)/$(LIB) __link
|
|
|
|
|
|
|
|
$(PLUGIN:=.opt) :
|
|
|
|
@[ -d $(OPTDIR) ] || mkdir $(OPTDIR)
|
|
|
|
@cd $(OPTDIR); \
|
|
|
|
$(MAKE) -f ../Makefile DOF=$(OPTF) TOPDIR=../${TOPDIR} \
|
|
|
|
THISDIR=../$(THISDIR)\
|
|
|
|
MAKEDEPEND=Makedepend $(PLUGIN)
|
|
|
|
@$(MAKE) LNSRC=$(OPTDIR)/$(PLUGIN) LNDEST=$(PLUGININST)/$(PLUGIN) __link
|
|
|
|
|
|
|
|
|
|
|
|
Makedepend : $(CXXFILES) $(CFILES)
|
|
|
|
ifeq ($(OS),IRIX)
|
|
|
|
touch $@
|
|
|
|
else
|
2002-04-10 06:54:43 +08:00
|
|
|
$(C++) $(INC) $(DEPARG) $^ > $(MAKEDEPEND)
|
2002-04-02 14:58:18 +08:00
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
.SUFFIXES: .cpp .o
|
|
|
|
.cpp.o:
|
|
|
|
$(C++) $(CXXFLAGS) -c $<
|
|
|
|
|
|
|
|
## This is an attempt at updating Makedepend file for each source
|
|
|
|
## file compiled rather than all files each time a source file changes
|
|
|
|
## Doesn't work too well, but leave the code here for later evaulation
|
|
|
|
ifeq (0,1)
|
|
|
|
ifneq ($(OS),IRIX)
|
|
|
|
$(C++) $(INC) $(DEPFLAGS) $< > .temp.dep
|
|
|
|
if [ -f $(MAKEDEPEND) ] ; \
|
|
|
|
then \
|
|
|
|
grep -v $< $(MAKEDEPEND) > .temp.dep1;\
|
|
|
|
else \
|
|
|
|
touch .temp.dep1; \
|
|
|
|
fi
|
|
|
|
cat .temp.dep1 .temp.dep > $(MAKEDEPEND)
|
|
|
|
rm -f .temp.dep1 .temp.dep
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
depend : $(MAKEDEPEND)
|
|
|
|
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
#
|
|
|
|
# Ok.. If you are looking hard at the following lines of gnarled code, you
|
|
|
|
# deserve an explanation. This target makes a link from the installed
|
|
|
|
# directories (Assumed to be rooted at $(TOPDIR), usually $(TOPDIR)/bin or
|
|
|
|
# $(TOPDIR)/lib) to a just-built target. Both LNSRC (Link source) and LNDEST
|
|
|
|
# (Link destination) must be defined before calling 'make __link'.
|
|
|
|
#
|
|
|
|
# The first four lines check to see that both LNSRC and LNDEST have been
|
|
|
|
# defined.
|
|
|
|
#
|
|
|
|
# The (very long) following 'if' statement reads in pseudo-code like this:
|
|
|
|
#
|
|
|
|
# if the current link is not pointing to the intended destination
|
|
|
|
# then
|
|
|
|
# announce (echo) intentions to reset link
|
|
|
|
# compute the link path by the following steps
|
|
|
|
# a) define SRCDIR as the current absolute directory
|
|
|
|
# appended by the directory of the intended source of the link
|
|
|
|
# b) define DESTDIR as the absolute path of $(TOPDIR) appended by
|
|
|
|
# the directory of the intended destination of the link
|
|
|
|
# c) define a temproary variable T to be the absolute path of
|
|
|
|
# the destination directory less the prefix of the absolute
|
|
|
|
# path of $(TOPDIR)
|
|
|
|
# e.g. /root/work/thisdir/bin/ - /root/work/thisdir/ = bin/
|
|
|
|
# d) Run a loop, truncating the path represented by T until
|
|
|
|
# 'dirname' returns '.'. On each iteration increment PFX
|
|
|
|
# (Prefix) by '../' This will define the prefix for the path
|
|
|
|
# of the link.
|
|
|
|
# e.g. If DESTDIR is lib/osgPlugins, PFX is ../../
|
|
|
|
# e) Define the link as a concatenation of PFX and the absolute
|
|
|
|
# path of the source directory less the absolute path of
|
|
|
|
# $(TOPDIR)
|
|
|
|
#
|
|
|
|
# Change directories in to the link destination directory
|
|
|
|
# run the link command
|
|
|
|
#
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
__link :
|
|
|
|
@[ -n "$(LNSRC)" ] || echo "Internal error (LNSRC definition)"
|
|
|
|
@[ -n "$(LNSRC)" ] && echo > /dev/null
|
|
|
|
@[ -n "$(LNDEST)" ] || echo "Internal error (LNDEST definition)"
|
|
|
|
@[ -n "$(LNDEST)" ] && echo > /dev/null
|
|
|
|
@if diff -s $(TOPDIR)/$(LNDEST) $(LNSRC) >/dev/null 2>&1;\
|
|
|
|
then\
|
|
|
|
echo " =====> $(LNSRC) and $(TOPDIR)/$(LNDEST) are in sync";\
|
|
|
|
else\
|
|
|
|
echo " =====> resetting $(TOPDIR)/$(LNDEST) to point to $(LNSRC)";\
|
|
|
|
SRCDIR=`pwd`/`dirname $(LNSRC)`;\
|
|
|
|
cd $(TOPDIR);\
|
|
|
|
ROOTDIR=`pwd`;\
|
|
|
|
DESTDIR=`dirname $$ROOTDIR/$(LNDEST)`;\
|
|
|
|
T=`echo $$DESTDIR $$ROOTDIR | \
|
|
|
|
awk '{print substr($$1,length($$2)+2,512)}'`;\
|
|
|
|
while [ "$$T" != "." ]; do T=`dirname $$T`;PFX=../"$$PFX";done;\
|
|
|
|
LINK="$$PFX"`echo $$SRCDIR $$ROOTDIR | awk \
|
|
|
|
'{ print substr($$1,length($$2)+2,512) }'`/`basename $(LNDEST)`;\
|
|
|
|
cd `dirname $(LNDEST)`;\
|
|
|
|
rm -f `basename $(LNDEST)`;\
|
|
|
|
$(LINK) $$LINK `basename $(LNDEST)`;\
|
|
|
|
fi
|
|
|
|
|
2002-04-09 22:55:38 +08:00
|
|
|
__instfiles :
|
|
|
|
@echo $(INSTFILES)
|
2002-04-02 14:58:18 +08:00
|
|
|
|
|
|
|
sinclude $(MAKEDEPEND)
|
|
|
|
|