GPLC   = @GPLC@
CC     = @CC@
CFLAGS = @CFLAGS@
EXEEXT = @EXEEXT@

all: ma2asm$(EXEEXT)

ma_parser.o: ma_parser.c ma_parser.h ma_protos.h
	$(CC) $(CFLAGS) -c ma_parser.c

ma2asm.o: ma2asm.c ma_protos.h ma_parser.h ../Wam2Ma/bt_string.c \
          ../TopComp/copying.c
	$(CC) $(CFLAGS) -c ma2asm.c

ma2asm_inst.o: ma2asm_inst.c ma_parser.h ../EnginePl/sys_conf.h \
               ix86_any.c ppc_linux.c sparc_any.c
	$(CC) $(CFLAGS) -c ma2asm_inst.c

ma2asm$(EXEEXT): ma2asm.o ma_parser.o ma2asm_inst.o ma2asm_inst.c
	$(CC) $(CFLAGS) -o ma2asm$(EXEEXT) ma2asm.o ma2asm_inst.o ma_parser.o


clean:
	rm -f *.o ma2asm$(EXEEXT)


distclean: clean



# for check
CHECK_OBJS=check.o check_ma.o ../EnginePl/engine.o ../EnginePl/engine1.o

check.o: check.c
	$(GPLC) -C '$(CFLAGS)' -c check.c

check_ma.s: check_ma.ma ma2asm
	$(GPLC) -S --comment check_ma.ma

check_ma.o: check_ma.s
	$(GPLC) -c check_ma.s

check$(EXEEXT): $(CHECK_OBJS)
	$(CC) $(CFLAGS) -o check$(EXEEXT)  $(CHECK_OBJS)

clean-check:
	rm -f check.o check_ma.s check_ma.o check$(EXEEXT)



# for test

t.wam: t.pl
	$(GPLC) -W t.pl

t.ma: t.wam
	$(GPLC) -M --comment t.wam

t.s: t.ma
	$(GPLC) -S --comment t.ma

t$(EXEEXT): t.s
	$(GPLC) -o t$(EXEEXT) t.s  --no-fd-lib




