include ../../Makeincl

LIBS      = -lm -lstdc++
CFLAGS    = 
AFLAGS    = 

ASMSOURCE = $(wildcard *.s)
CSOURCE   = $(wildcard *.c)
CSOURCE   += $(wildcard *.cc)


all:	$(addsuffix .o,$(basename $(CSOURCE)) $(basename $(ASMSOURCE))) Control.hex

Control.hex: $(CSOURCE) $(ASMSOURCE)

clean:
	-$(RM)	$(addsuffix .hex,$(basename $(CSOURCE)) $(basename $(ASMSOURCE))) \
		$(addsuffix .o,$(basename $(ASMSOURCE))) \
		$(addsuffix .o,$(basename $(CSOURCE))) \
		$(addsuffix .elf,$(basename $(ASMSOURCE))) \
		core

%.hex:	%.c
	$(CC68) $(CFLAGS) -o $@ $< $(LIBS)

%.o:	%.cc
	$(CC68) $(CFLAGS) -c -o $@ $<

%.hex:	%.cc
	$(CC68) $(CFLAGS) -o $@ *.o $(LIBS)

%.hex:	%.s
	$(AS68) $(AFLAGS) -o $@ $< $(LIBS)
	-$(RM) $(addsuffix .o,$(basename $<))
