voron

experimental ARM OS
git clone git://git.2f30.org/voron
Log | Files | Refs | README | LICENSE

Makefile (2033B)


      1 CROSS_COMPILE ?= arm-none-eabi-
      2 MAKEFLAGS += -rR --no-print-directory
      3 INC = -Iinclude
      4 LDFLAGS = -T kernel/linker.ld -nostdlib -nostdinc -nodefaultlibs -nostartfiles \
      5 	   -fno-builtin
      6 CFLAGS =  -march=armv7-r -ggdb -Wall -Wextra -Wformat-security -Wshadow \
      7 	   -Wunreachable-code -Wpointer-arith -O2 -std=gnu99 -nostdlib \
      8 	   -nostdinc -nodefaultlibs -nostartfiles -fno-builtin $(INC)
      9 ASFLAGS = -march=armv7-r -ggdb -nostdlib -nostdinc -nodefaultlibs \
     10 	   -nostartfiles -fno-builtin $(INC)
     11 LIBGCC = -L $(shell dirname $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)) -lgcc
     12 CC = $(CROSS_COMPILE)gcc
     13 LD = $(CROSS_COMPILE)ld
     14 OBJCOPY = $(CROSS_COMPILE)objcopy
     15 NM = $(CROSS_COMPILE)nm
     16 
     17 KERNEL_SRCS_C = $(wildcard kernel/*.c)
     18 KERNEL_SRCS_S = $(wildcard kernel/*.S)
     19 KERNEL_SRCS = $(KERNEL_SRCS_C) $(KERNEL_SRCS_S)
     20 KERNEL_OBJS = $(KERNEL_SRCS_C:%.c=%.o) $(KERNEL_SRCS_S:%.S=%.o)
     21 HDRS = $(wildcard include/*.h)
     22 
     23 all: uImage kernel.syms
     24 
     25 kernel.elf: $(KERNEL_OBJS) kernel/linker.ld
     26 	@echo -e "  LD\t$@"
     27 	@$(CC) $(LDFLAGS) -o $@ $(KERNEL_OBJS) $(LIBGCC)
     28 
     29 kernel.bin: kernel.elf
     30 	@$(OBJCOPY) $< -O binary $@
     31 
     32 kernel.syms: kernel.elf
     33 	@$(NM) $< > $@
     34 
     35 uImage: kernel.bin
     36 	@mkimage -A arm -T kernel -C none -a 0x82000000 -e 0x82000000 -n Voron -d $< $@
     37 
     38 %.o: %.c $(HDRS)
     39 	@echo -e "  CC\t$<"
     40 	@$(CC) $(CFLAGS) -c -o $@ $<
     41 
     42 %.o: %.S $(HDRS)
     43 	@echo -e "  AS\t$<"
     44 	@$(CC) $(ASFLAGS) -c -o $@ $<
     45 
     46 bootloader:
     47 	[ -d boot/u-boot-linaro-stable ] || (cd boot && \
     48 	    git clone git://git.linaro.org/boot/u-boot-linaro-stable.git)
     49 	make -C boot/u-boot-linaro-stable CROSS_COMPILE=$(CROSS_COMPILE) omap4_panda_config
     50 	make -C boot/u-boot-linaro-stable CROSS_COMPILE=$(CROSS_COMPILE)
     51 	cd boot && mkimage -A arm -T script -C none -a 0 -e 0 -n "Panda SD Boot" -d boot_sd.conf boot.scr
     52 
     53 bootloader_clean:
     54 	@rm -rf boot/boot.scr boot/u-boot-linaro-stable boot/omap4boot
     55 
     56 clean:
     57 	@rm -f $(KERNEL_OBJS) kernel.elf kernel.bin kernel.syms uImage voron.tar.gz
     58 
     59 targz:
     60 	@git archive --format=tar.gz --prefix=voron/ -o voron.tar.gz HEAD
     61 	@echo voron.tar.gz created