#
# Makefile  -  !MidiPlay build definition
#
# (using gccsdk 4.7.4)
# created 12/2021

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.audio o.display \
  o.command o.kbd o.midi o.player o.store o.filters o.kbd_dsplay \
  o.editor o.channel o.tables o.SoundSet

A_OBJ = o.plot o.buffer o.fft o.fmull

# select c or assembler synth sample rate code, assembler is a bit faster
A_OBJ += o.synth-s
#C_OBJ += o.synth-c

# This file contains the version string and the build time stamp.
# It will be compiled if anything has changed.
V_OBJ = o.version

H_SRC = h.editor h.filters h.instrument h.kbd h.kbd_dsplay h.main \
  h.midi h.midisyn h.player h.midi_spec h.lib h.ro_main h.wimp \
  h.store h.wave_spec h.exp h.channel

OBJS = $(A_OBJ) $(C_OBJ) $(V_OBJ)

App = ^.!RunImage

MidiPlay: $(App)

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

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

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

# Time stamp
$(V_OBJ): $(A_OBJ) $(C_OBJ)

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

clean:
	wipe o.* ~C~V


