2011-08-30 10:02:08 +00:00
|
|
|
CROSS=xenon-
|
|
|
|
CC=$(CROSS)gcc
|
|
|
|
OBJCOPY=$(CROSS)objcopy
|
|
|
|
LD=$(CROSS)ld
|
|
|
|
AS=$(CROSS)as
|
|
|
|
STRIP=$(CROSS)strip
|
|
|
|
|
|
|
|
LV1_DIR=source/lv1
|
|
|
|
|
|
|
|
# Configuration
|
|
|
|
CFLAGS = -Wall -Os -I$(LV1_DIR) -ffunction-sections -fdata-sections \
|
2012-09-04 18:40:47 +00:00
|
|
|
-m64 -mno-toc -DBYTE_ORDER=BIG_ENDIAN -mno-altivec -D$(CURRENT_TARGET) $(CYGNOS_DEF)
|
2011-08-30 10:02:08 +00:00
|
|
|
|
|
|
|
AFLAGS = -Iinclude -m64
|
|
|
|
LDFLAGS = -nostdlib -n -m64 -Wl,--gc-sections
|
|
|
|
|
|
|
|
OBJS = $(LV1_DIR)/startup.o \
|
|
|
|
$(LV1_DIR)/main.o \
|
|
|
|
$(LV1_DIR)/cache.o \
|
|
|
|
$(LV1_DIR)/ctype.o \
|
|
|
|
$(LV1_DIR)/string.o \
|
|
|
|
$(LV1_DIR)/time.o \
|
|
|
|
$(LV1_DIR)/vsprintf.o \
|
|
|
|
$(LV1_DIR)/puff/puff.o
|
|
|
|
|
2012-09-04 18:40:47 +00:00
|
|
|
TARGETS = xell-1f xell-2f xell-gggggg xell-gggggg_cygnos_demon xell-1f_cygnos_demon xell-2f_cygnos_demon
|
2011-08-30 10:02:08 +00:00
|
|
|
|
|
|
|
# Build rules
|
|
|
|
all: $(foreach name,$(TARGETS),$(addprefix $(name).,build))
|
|
|
|
|
|
|
|
.PHONY: clean %.build
|
|
|
|
|
|
|
|
clean:
|
|
|
|
@echo Cleaning...
|
|
|
|
@$(MAKE) --no-print-directory -f Makefile_lv2.mk clean
|
|
|
|
@rm -rf $(OBJS) $(foreach name,$(TARGETS),$(addprefix $(name).,bin elf)) stage2.elf32.gz
|
|
|
|
|
|
|
|
%.build:
|
|
|
|
@echo Building $* ...
|
|
|
|
@$(MAKE) --no-print-directory $*.bin
|
|
|
|
|
|
|
|
.c.o:
|
|
|
|
@echo [$(notdir $<)]
|
|
|
|
@$(CC) $(CFLAGS) -c -o $@ $*.c
|
|
|
|
|
|
|
|
.S.o:
|
|
|
|
@echo [$(notdir $<)]
|
|
|
|
@$(CC) $(AFLAGS) -c -o $@ $*.S
|
|
|
|
|
|
|
|
xell-gggggg.elf: CURRENT_TARGET = HACK_GGGGGG
|
|
|
|
xell-1f.elf xell-2f.elf: CURRENT_TARGET = HACK_JTAG
|
|
|
|
|
2012-09-04 18:40:47 +00:00
|
|
|
xell-gggggg_cygnos_demon.elf: CURRENT_TARGET = HACK_GGGGGG
|
|
|
|
xell-gggggg_cygnos_demon.elf: CYGNOS_DEF = -DCYGNOS
|
|
|
|
xell-1f_cygnos_demon.elf xell-2f_cygnos_demon.elf: CURRENT_TARGET = HACK_JTAG
|
|
|
|
xell-1f_cygnos_demon.elf xell-2f_cygnos_demon.elf: CYGNOS_DEF = -DCYGNOS
|
|
|
|
|
2011-08-30 10:02:08 +00:00
|
|
|
%.elf: $(LV1_DIR)/%.lds $(OBJS)
|
|
|
|
@$(CC) -n -T $< $(LDFLAGS) -o $@ $(OBJS)
|
|
|
|
|
|
|
|
stage2.elf32.gz: FORCE
|
|
|
|
@rm -f $@
|
|
|
|
@$(MAKE) --no-print-directory -f Makefile_lv2.mk
|
|
|
|
@$(STRIP) stage2.elf32
|
|
|
|
@gzip -n9 stage2.elf32
|
|
|
|
|
|
|
|
%.bin: %.elf stage2.elf32.gz
|
|
|
|
@$(OBJCOPY) -O binary $< $@
|
|
|
|
@truncate --size=262128 $@ # 256k - footer size
|
|
|
|
@echo -n "xxxxxxxxxxxxxxxx" >> $@ # add footer
|
|
|
|
@dd if=stage2.elf32.gz of=$@ conv=notrunc bs=16384 seek=1 # inject stage2
|
|
|
|
|
2012-09-04 18:40:47 +00:00
|
|
|
FORCE:
|