Skip to content

Instantly share code, notes, and snippets.

@siritori
Created July 13, 2010 10:42
Show Gist options
  • Save siritori/473715 to your computer and use it in GitHub Desktop.
Save siritori/473715 to your computer and use it in GitHub Desktop.
INCLUDES = src src_api src_sys src_usb
AS = h8300-elf-as
CC = h8300-elf-gcc -msx -mint32 -c $(addprefix -I../, $(INCLUDES))
LINK = h8300-elf-gcc -msx -mint32 -nostartfiles -nodefaultlibs
ASFLAGS = -g3
CFLAGS = -O0 -g3 -Wall
LINKFLAGS = -g3
OBJCOPY = h8300-elf-objcopy
LIBS = -lc -lm -lgcc
LDSCRIPT = ../ldscript/H8SX_1655.link
TARGET = PROG.mot
USER_OBJS =
OBJS = main.o analog.o bsc.o cpg.o dmac.o \
dtc.o fat16.o gpio.o graphics.o key.o \
lcd1602.o lcdpanel.o rtc.o sdcard.o \
spi.o tmr.o touch.o console.o \
irq.o malloc.o retarget.o start.o stub.o \
uart.o usb.o vects.o DoBulk.o DoControl.o \
DoRequest.o DoRequestComCommand.o \
DoRequestVenderCommand.o \
DoSerial.o StartUp.o UsbMain.o
.PHONY: all clean
all: $(TARGET)
$(TARGET): PROG.elf
@$(OBJCOPY) -O srec PROG.elf $@
@h8300-elf-size PROG.elf
PROG.elf: $(OBJS)
@echo 'Invoking: Cygwin C Linker'
@$(LINK) $(LIBS) -Xlinker -T$(LDSCRIPT) -Xlinker -Map=PROG.map -o$@ $(OBJS) $(USER_OBJS) $(LIBS)
@echo 'Finished building target: $@'
%.o: ../src/%.c
@echo 'Building file: $<'
@$(CC) -c $(CFLAGS) -o$@ $<
%.o: ../src_api/%.c
@echo 'Building file: $<'
@$(CC) -c $(CFLAGS) -o$@ $<
%.o: ../src_sys/%.c
@echo 'Building file: $<'
@$(CC) -c $(CFLAGS) -o$@ $<
%.o: ../src_sys/%.S
@echo 'Building file: $<'
@$(AS) -o$@ $<
%.o: ../src_usb/%.c
@echo 'Building file: $<'
@$(CC) -c $(CFLAGS) -o$@ $<
clean:
-$(RM) $(OBJS) PROG.elf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment