#######################################################################
# WAD Makefile
#
# David Beazley
# January 1, 2001
#######################################################################

# These are the files that make up the WAD core
WADSRCS = string.c vars.c io.c memory.c return.c default.c stack.c stab.c elf.c object.c init.c segment.c signal.c
WADOBJS = string.o vars.o io.o memory.o return.o default.o stack.o stab.o elf.o object.o signal.o segment.o init.o
INCLUDE = -I../Include -I.  $(SINCLUDE)
WADOPT     = @WADOPT@


# Location of your Perl installation
PERLINCLUDE = @PERL5EXT@
PERLSRCS   = wadpl.cxx
PERLOBJS   = wadpl.o

# C Compiler
CC = @CC@
CFLAGS = #@CCSHARED@

# C++ Compiler
CXX = @CXX@
CXXFLAGS = #@CXXSHARED@

# Linking options
CLINK = 
CXXLINK = @CXXLINK@

# AR
AR = @AR@

# Rules for creation of a .o file from .cxx
.SUFFIXES: .cxx
.cxx.o:
	$(CXX) $(CXXFLAGS) $(WADOPT) $(INCLUDE) -c -o $*.o $<

.c.o:
	$(CC) $(CFLAGS) $(WADOPT) $(INCLUDE) -c -o $*.o $<

wad:    $(WADOBJS) main.o
	$(CXXLINK) $(WADOBJS) main.o -o libwad.so 
	$(AR) cr libwadcore.a $(WADOBJS)
	cp libwad.so ..
	cp libwadcore.a ..

perl: wad_perl_handler.c $(WADOBJS) $(PERLOBJS)
	$(CXXLINK) $(WADOBJS) $(PERLOBJS) -o libwadpl.so
	cp libwadpl.so ..

wad_perl_handler.c:
	python makehandler.py

debug::
	cc -g debug.c $(INCLUDE) -L. -R. -lwad

plus::
	CC -g debug.cxx $(INCLUDE) -L. -R. -lwad

wc::
	wc $(SRCS)

semi::
	@egrep ";" $(WADSRCS) plat/*.c | wc

clean::
	rm -f *.o *.so *~ 




