#
# Makefile  -  !MidCon build definition
#
# uses gccsdk 4.7.4 release 6

CC = gcc
CFLAGS = -mlibscl -c -Wall -mthrowback -O2 -mpoke-function-name
AS = gcc
ASFLAGS = -mlibscl -c -Wall -mthrowback
LD = gcc
LDFLAGS = -mlibscl

# listings
#CFLAGS += -fverbose-asm -save-temps
#LDFLAGS += -Wl,-Map=map

C_OBJ = o.main o.lib o.kbd o.midi o.store o.choices o.tables o.SoundSet \
 o.player o.bitstream o.coder o.huffman o.loop o.mp3 

A_OBJ = o.fft o.coder_sa o.utils o.fmull

H_SRC = h.choices h.instrument h.midi_spec h.kbd h.midi h.store h.lib \
  h.main h.wimp h.table1 h.table2 h.types h.wave_spec

# Select 'c' or assembler synth sample generator code.
# assembler is about 30% faster.
# 'c' is easier to modify.
A_OBJ += o.synth-s
#C_OBJ += o.synth-c

OBJS = $(A_OBJ) $(C_OBJ)

App = ^.!RunImage

MidiCon: $(App)

# Link          
$(App): $(OBJS)
	$(LD) $(LDFLAGS) -o $@ $(OBJS)

# Compile
$(C_OBJ): o.%: c.%
	$(CC) $(CFLAGS) $<

# Assemble
$(A_OBJ): o.%: s.%
	$(AS) $(ASFLAGS) $<

# Headers
$(OBJS): $(H_SRC) Makefile

clean:
	wipe o.* ~C~V


