forked from tangrs/nspire-linux-loader2
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
38 lines (29 loc) · 962 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
include libfdt/Makefile.libfdt
GCC = nspire-gcc
LD = nspire-ld
GCCFLAGS = -mcpu=arm926ej-s -Os -nostdlib -Werror -Wall -marm -Ilibfdt/
# Feel free to comment the following lines out if you're
# not using git or you don't want the build date included
BUILDFLAGS := -DBUILD_DATE="\"$(shell date --rfc-2822)\""
BUILDFLAGS += -DGIT_COMMIT="\"$(shell git rev-parse --short HEAD)\""
LDFLAGS = -lnspireio
OBJCOPY := "$(shell which arm-elf-objcopy 2>/dev/null)"
ifeq (${OBJCOPY},"")
OBJCOPY := arm-none-eabi-objcopy
endif
EXE = ndroidloader.tns
OBJS = $(patsubst %.c,%.o,$(wildcard *.c))
OBJS += $(patsubst %.S,%.o,$(wildcard *.S))
OBJS += $(addprefix libfdt/, $(LIBFDT_OBJS))
vpath %.tns $(DISTDIR)
all: $(EXE)
%.o: %.c
$(GCC) $(BUILDFLAGS) $(GCCFLAGS) -c $< -o $@
%.o: %.S
$(GCC) $(BUILDFLAGS) $(GCCFLAGS) -c $< -o $@
$(EXE): $(OBJS)
$(LD) $^ -o $(@:.tns=.elf) $(LDFLAGS)
$(OBJCOPY) -O binary $(@:.tns=.elf) $@
clean:
rm -f $(OBJS) *.elf
rm -f $(EXE)