Subversion Repositories freemyipod

Rev

Rev 457 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
253 theseven 1
NAME := uclstub
2
 
462 theseven 3
ifeq ($(shell uname),WindowsNT)
4
CCACHE :=
5
else
6
CCACHE := $(shell which ccache)
7
endif
8
 
457 theseven 9
CROSS   ?= arm-elf-eabi-
462 theseven 10
CC      := $(CCACHE) $(CROSS)gcc
253 theseven 11
AS      := $(CROSS)as
12
LD      := $(CROSS)ld
13
OBJCOPY := $(CROSS)objcopy
14
 
15
CFLAGS  += -Os -fno-pie -fno-stack-protector -fomit-frame-pointer -I. -ffunction-sections -fdata-sections -mcpu=arm940t
16
LDFLAGS += "$(shell $(CC) -print-libgcc-file-name)" --gc-sections
17
 
18
SRC := ucl.S
19
OBJ := $(SRC:%.S=build/%.o)
20
 
21
all: $(NAME)
22
 
23
$(NAME): build/$(NAME).bin
24
 
25
build/$(NAME).bin: build/$(NAME).elf
26
	@echo [OC]     $<
27
	@$(OBJCOPY) -O binary $^ $@
28
 
29
build/$(NAME).elf: $(OBJ) ls.x
30
	@echo [LD]     $@
31
	@$(LD) $(LDFLAGS) -T ls.x -o $@ $(OBJ)
32
 
33
build/%.o: %.S
34
	@echo [CC]     $<
35
ifeq ($(shell uname),WindowsNT)
36
	@-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
37
else
38
	@-mkdir -p $(dir $@)
39
endif
40
	@$(CC) -c $(CFLAGS) -o $@ $<
41
 
42
clean:
43
	rm -rf build
44
 
45
.PHONY: all clean $(NAME)