# Define your compiler.
CC = gcc

# If you want to use etherlib define these:
# Be sure to stick your router default enet address here.
#ETHERDEF= -DUSE_ETHERLIB
#ETHERDIR= ethersrc
#ETHERLIB= $(ETHERDIR)/libether.a
#ETHERINC= -I$(ETHERDIR)

# If you're on solaris, or some other system that supports dlpi, dont
# define any of the above ETHER stuff, and define these.
#ETHERDEF= -DUSE_DLPI
#ETHERDIR= dlpi
#ETHERLIB= $(ETHERDIR)/libdlcommon.a
#ETHERINC= -I$(ETHERDIR)

# For linux there is some special stuff.
LINUXINC= -I.
LINUXDEF= -DLINUX # -DUSE_SOCK_PACK

# Define your router if you are using DLPI or ETHERLIB
ROUTER= -DROUTER=\"aa:0:4:0:ff:f3\"
#ROUTER= -DROUTER=\"0:0:c:5:3e:18\"

# Your CFLAGS may vary widely.
# And these are good for Solaris 2.x, and probably most SYSV's.
CDEBUGFLAGS = -O2 -DSYSV

# These for SunOs 4.1.3, and probably Ultrix
#CDEBUGFLAGS = -O2

# These flags for linux, or some shit.
# CDEBUGFLAGS = -O2 -include /usr/include/bsd/bsd.h -I/usr/include/bsd 


# Your LDFLAGS may also vary.
# Use this for solaris 2.x
# LDFLAGS = -s -lsocket -lnsl
# -s is generally ok elsewhere
LDFLAGS = -s

INCLUDES=$(ETHERINC)
ALLDEFINES=$(ETHERINC) $(ETHERDEF) $(ROUTER) $(LINUXINC) $(LINUXDEF)
ALL_LIBS=$(LDFLAGS) $(ETHERLIB)

CFLAGS=$(CDEBUGFLAGS) $(ALLDEFINES)

# Sources/objects
SRCS=pingmod.c
OBJS=pingmod.o

PROG = pingmod

all: $(PROG)

$(ETHERLIB):
	( cd $(ETHERDIR) ; make all )

pingmod: $(OBJS) $(ETHERLIB)
	$(CC) -o $@ $(OBJS) $(ALL_LIBS)

pml: pml.o
	$(CC) -o $@ pml.o $(ALL_LIBS)

clean:
	rm -f *.o *~ core dlpi/*.o dlpi/*.a ethersrc/*.o ethersrc/*.a

