# this file automatically gets inserted into Makefiles generated by opp_makemake

# preserve default target
all: checkdirs $(TARGET)

checkdirs:
	@if [ -d Applications/MLD ]; then \
	    echo '-----------------------------------------------------------------'; \
	    echo 'Error: you have empty directories checked out -- please run'; \
	    echo '"cvs update -dP" to get rid of them, then re-run ./makemake and make.'; \
	    echo 'Checkout should be done with -P as well: "cvs co -P IPv6SuiteWithINET"'; \
	    echo '-----------------------------------------------------------------'; \
	    exit 1; \
	fi
	@if ! [ -f $(OMNETPP_INCL_DIR)/omnetpp.h ]; then \
	    echo '-----------------------------------------------------------------'; \
	    echo 'Error: $(OMNETPP_INCL_DIR) does not have omnetpp.h in it -- your'; \
	    echo 'omnetppconfig file is probably out of date. Please re-generate it'; \
	    echo 'with "opp_makemake -f --genconfig omnetppconfig", then run make again.'; \
	    echo '-----------------------------------------------------------------'; \
	    exit 1; \
	fi

# all _m.h files must exist before we build anything, so run opp_msgc first
subdirs $(OBJS) : generateheaders

# add dependencies across directories
bin: Applications Transport Network NetworkInterfaces PHY Mobility World Base Util Nodes
Network Transport NetworkInterfaces PHY Applications : Base Util
Transport NetworkInterfaces Applications : Network
Nodes : Network Transport NetworkInterfaces PHY Mobility Applications World
Examples Tests : Nodes
Examples : Tests  # this is just for convenience, can be removed

# documentation targets
DOC_DIR=Documentation

docs: doxy neddoc tcptut

doxy:
	doxygen doxy.cfg

neddoc:
	opp_neddoc -o $(DOC_DIR)/neddoc -t $(DOC_DIR)/doxy/doxytags.xml -d ../doxy *.ned *.msg $(SUBDIRS)

neddoc-without-doxy:
	opp_neddoc -o $(DOC_DIR)/neddoc *.ned *.msg $(SUBDIRS)

tcptut:
	cd $(DOC_DIR)/src/tcp && make
