view src/usr/makfile-armgccbc @ 17:c0f6f3eb25ae

argccbc
author kono
date Sun, 25 Feb 2018 18:48:39 +0900
parents
children
line wrap: on
line source

include ../makefile.inc

CC = /usr/local/arm-cbc/bin/arm-none-eabi-gcc -B/usr/local/arm-cbc/bin/arm-none-eabi-
AS = arm-linux-gnu-gcc
LD = arm-linux-gnu-ld
OBJCOPY = arm-linux-gnu-objcopy
OBJDUMP = arm-linux-gnu-objdump
CFLAGS = -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -I. -g -O0

ASFLAGS = 

LIBGCC = $(shell $(CC) -print-libgcc-file-name)

LINK_BIN = $(call quiet-command,$(LD) $(LDFLAGS) \
        -T $(1) -o $(2) $(3) $(LIBS) -b binary $(4), "  LINK     $(TARGET_DIR)$@")

LINK_INIT = $(call quiet-command,$(LD) $(LDFLAGS) \
        $(1) -o $@.out $<, "  LINK     $(TARGET_DIR)$@")
OBJCOPY_INIT = $(call quiet-command,$(OBJCOPY) \
        -S -O binary --prefix-symbols="_binary_$@" $@.out $@, "  OBJCOPY  $(TARGET_DIR)$@")
AS_WITH = $(call quiet-command,$(AS) $(ASFLAGS) \
                $(1) -c -o $@ $<,"  AS       $(TARGET_DIR)$@")

CFLAGS += -iquote ../
ASFLAGS += -I ../
ULIB = ulib.o usys.o printf.o umalloc.o

MKFS = ../tools/mkfs
FS_IMAGE = ../build/fs.img

UPROGS=\
	_cat\
	_echo\
	_grep\
	_init\
	_kill\
	_ln\
	_ls\
	_mkdir\
	_rm\
	_sh\
	_stressfs\
	_usertests\
	_wc\
	_zombie\
	_hello\
	_forktest\


all: $(FS_IMAGE)

_%: %.o $(ULIB)
	$(LD) $(LDFLAGS) -N -e main -Ttext 0 -o $@ $^  -L ../ $(LIBGCC)
	$(OBJDUMP) -S $@ > $*.asm
	$(OBJDUMP) -t $@ | sed '1,/SYMBOL TABLE/d; s/ .* / /; /^$$/d' > $*.sym

_forktest: forktest.o $(ULIB)
	# forktest has less library code linked in - needs to be small
	# in order to be able to max out the proc table.
	$(LD) $(LDFLAGS) -N -e main -Ttext 0 -o _forktest forktest.o ulib.o usys.o
	$(OBJDUMP) -S _forktest > forktest.asm

$(FS_IMAGE): $(MKFS)  $(UPROGS)
	$(MKFS) $@  $(UPROGS) UNIX
	$(OBJDUMP) -S usys.o > usys.asm

clean: 
	rm -f *.o *.d *.asm *.sym $(FS_IMAGE) \
	.gdbinit \
	$(UPROGS)