### 
# HOW TO MAKE netsim
# Step 1) "make clean;make dep"
# Step 2) "make"
####

####
# Just change OFILES and TARGET and you should be done.
# Note that "Makefile.tmp" will be created (and then deleted) when you 
# run "make dep". 
####

####
# OFILES is a list of all "*.o" compiled files. Note this script and the
# mkdep utility assume "blah.o" comes from "blah.c", and NOT from "blah.cc"
# or any other forms. 
OFILES = \
	main.o \
	network.o \
	magicmedium.o \
	magicnet.o \
	pksource.o \
	wireless.o \
	hwmgr.o \
	nsfile.o \
	dsr.o \
	wire.o \
	schedule.o \
	nam.o 
#	memmgr.o \

####
# TARGET is the final name of your executable. 
TARGET = netsim

###########################################################################
# I don't think you should have to change anything else, except maybe the
# CFLAGS / LFLAGS.
MAKEFILE = Makefile
CC=gcc

## Debian Linux:
# CFLAGS = -c -Wall -g -DLINUX
# LFLAGS = -lm
## RedHat Linux:
# CFLAGS = -c -Wall -g
CFLAGS = -c -Wall -O2
LFLAGS = -lm
#### BSD:
#CFLAGS = -g -Wall -Wno-unused
#### Solaris: 
#CFLAGS = -g -Wall -DSOLARIS -I ../../include
#LFLAGS = -L ../../lib -lm


$(TARGET): $(OFILES)
	$(CC) $(LFLAGS) $(OFILES) -o $(TARGET)

mkdep: mkdep.c
	$(CC) $(CFLAGS) mkdep.c -o mkdep.o
	$(CC) $(LFLAGS) mkdep.o -o mkdep

dep: mkdep
	rm -f Makefile.tmp
	mkdep $(MAKEFILE) $(OFILES) > Makefile.tmp
	mv Makefile.tmp $(MAKEFILE)
	
clean: 
	rm -f $(OFILES) $(TARGET) mkdep



##########################################################################
#                   DO NOT EDIT BELOW THIS POINT!!!!                     #
#   Everything below this point is automatically recreated every time    #
#                          you call "make dep".                          #
##########################################################################
#### MARKER - DO NOT EDIT THIS LINE ####
main.o: main.c  network.h nsfile.h schedule.h nam.h wire.h dsr.h
	$(CC) $(CFLAGS) main.c -o main.o

network.o: network.c  network.h memmgr.h schedule.h nam.h
	$(CC) $(CFLAGS) network.c -o network.o

magicmedium.o: magicmedium.c  memmgr.h network.h magicmedium.h
	$(CC) $(CFLAGS) magicmedium.c -o magicmedium.o

magicnet.o: magicnet.c  memmgr.h network.h magicnet.h
	$(CC) $(CFLAGS) magicnet.c -o magicnet.o

pksource.o: pksource.c  memmgr.h network.h pksource.h
	$(CC) $(CFLAGS) pksource.c -o pksource.o

wireless.o: wireless.c  memmgr.h network.h wireless.h
	$(CC) $(CFLAGS) wireless.c -o wireless.o

hwmgr.o: hwmgr.c  network.h hwmgr.h pksource.h magicnet.h dsr.h magicmedium.h wireless.h wire.h
	$(CC) $(CFLAGS) hwmgr.c -o hwmgr.o

nsfile.o: nsfile.c  network.h hwmgr.h nsfile.h schedule.h
	$(CC) $(CFLAGS) nsfile.c -o nsfile.o

dsr.o: dsr.c  memmgr.h network.h dsr.h nam.h
	$(CC) $(CFLAGS) dsr.c -o dsr.o

wire.o: wire.c  memmgr.h network.h wire.h nam.h
	$(CC) $(CFLAGS) wire.c -o wire.o

schedule.o: schedule.c  memmgr.h
	$(CC) $(CFLAGS) schedule.c -o schedule.o

nam.o: nam.c  network.h schedule.h memmgr.h
	$(CC) $(CFLAGS) nam.c -o nam.o

