comparison makefile-armgccbc @ 6:60f514338238

add
author mir3636
date Wed, 24 Oct 2018 20:48:46 +0900
parents
children
comparison
equal deleted inserted replaced
5:b5220d63570e 6:60f514338238
1 ###############################################################################
2 # makefile
3 # by Alex Chadwick
4 #
5 # A makefile script for generation of raspberry pi kernel images.
6 ###############################################################################
7
8 # The toolchain to use. arm-none-eabi works, but there does exist
9 # arm-bcm2708-linux-gnueabi.
10 ARMGNU ?= /usr/local/arm-cbc/bin/arm-none-eabi
11 # ARMGNU ?= arm-none-eabi
12
13 # The intermediate directory for compiled object files.
14 BUILD = build/
15
16 # The directory in which source files are stored.
17 SOURCE = source/
18
19 # The name of the output file to generate.
20 TARGET = kernel.img
21
22 # The name of the assembler listing file to generate.
23 LIST = kernel.list
24
25 # The name of the map file to generate.
26 MAP = kernel.map
27
28 # The name of the linker script to use.
29 LINKER = kernel.ld
30
31 # The names of libraries to use.
32 LIBRARIES := csud
33
34 #CFLAGS := -mfloat-abi=hard -fno-pic -static -Wno-packed-bitfield-compat -fno-builtin -fno-strict-aliasing -fshort-wchar -O2 -Wall -MD -ggdb -Werror -fno-omit-frame-pointer -fno-stack-protector -Wa,-march=armv6 -Wa,-mcpu=arm1176jzf-s -I include
35 CFLAGS := -mfpu=vfpv4 -mfloat-abi=hard -fno-pic -static -Wno-packed-bitfield-compat -fno-builtin -fno-strict-aliasing -fshort-wchar -O2 -Wall -MD -ggdb -fno-omit-frame-pointer -fno-stack-protector -Wa,-march=armv6 -Wa,-mcpu=arm1176jzf-s -I include
36
37 CC := gcc -B/usr/local/arm-cbc/bin/arm-none-eabi-
38
39 # The names of all object files that must be generated. Deduced from the
40 # assembly code files in source.
41 OBJECTS := $(patsubst $(SOURCE)%.s,$(BUILD)%.o,$(wildcard $(SOURCE)*.s))
42
43 C_OBJS := $(patsubst $(SOURCE)%.c,$(BUILD)%.o,$(wildcard $(SOURCE)*.c))
44
45 # Rule to make everything.
46 all: $(TARGET) $(LIST)
47
48 # Rule to remake everything. Does not include clean.
49 #rebuild: all
50
51 # Rule to make the listing file.
52 $(LIST) : $(BUILD)output.elf
53 $(ARMGNU)-objdump -d $(BUILD)output.elf > $(LIST)
54
55 # Rule to make the image file.
56 $(TARGET) : $(BUILD)output.elf
57 $(ARMGNU)-objcopy $(BUILD)output.elf -O binary $(TARGET)
58
59 # Rule to make the elf file.
60 $(BUILD)output.elf : $(OBJECTS) $(C_OBJS) $(LINKER)
61 $(ARMGNU)-ld --no-undefined $(OBJECTS) $(C_OBJS) -L. $(patsubst %,-l %,$(LIBRARIES)) -Map $(MAP) -o $(BUILD)output.elf -T $(LINKER)
62
63 # Rule to make the object files.
64 $(BUILD)%.o: $(SOURCE)%.s $(BUILD)
65 $(ARMGNU)-as -I $(SOURCE) $< -o $@
66
67 $(BUILD)%.o: $(SOURCE)%.c $(BUILD)
68 $(ARMGNU)-$(CC) -c $(CFLAGS) $< -o $@
69
70 $(BUILD):
71 mkdir $@
72
73 # Rule to clean files.
74 clean :
75 -rm -rf $(BUILD)
76 -rm -f $(TARGET)
77 -rm -f $(LIST)
78 -rm -f $(MAP)