#
# Makefile for the MidiMan driver management application
# (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
#CFLAGS += -fverbose-asm -S
#LDFLAGS += -Wl,-Map=map

C_OBJ = o.main o.modules o.drivers o.lib o.routes

A_OBJ = o.line o.rectangle

H_SRC = h.main h.wimp h.lib h.modules h.drivers h.routes

OBJS = $(A_OBJ) $(C_OBJ)

App = ^.!RunImage

MidiMan: $(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


