-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
53 lines (38 loc) · 1.36 KB
/
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
###############################################################################
# Copyright (c) 2010 Linaro Limited
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
# Peter Maydell (Linaro) - initial implementation
# Claudio Fontana (Linaro) - small refactoring and aarch64 support
###############################################################################
# import the variables generated by configure
include Makefile.in
VPATH=$(SRCDIR)
CFLAGS ?= -g
ALL_CFLAGS = -Wall -D_GNU_SOURCE -DARCH=$(ARCH) $(BUILD_INC) $(CFLAGS) $(EXTRA_CFLAGS)
PROG=risu
SRCS=risu.c comms.c reginfo.c risu_$(ARCH).c risu_reginfo_$(ARCH).c
HDRS=risu.h
BINS=test_$(ARCH).bin
# For dumping test patterns
RISU_BINS=$(wildcard *.risu.bin)
RISU_ASMS=$(patsubst %.bin,%.asm,$(RISU_BINS))
OBJS=$(SRCS:.c=.o)
all: $(PROG) $(BINS)
dump: $(RISU_ASMS)
$(PROG): $(OBJS)
$(CC) $(STATIC) $(ALL_CFLAGS) -o $@ $^ $(LDFLAGS)
%.risu.asm: %.risu.bin
${OBJDUMP} -b binary -m $(ARCH) -D $^ > $@
%.o: %.c $(HDRS)
$(CC) $(CPPFLAGS) $(ALL_CFLAGS) -o $@ -c $<
%_$(ARCH).bin: %_$(ARCH).elf
$(OBJCOPY) -O binary $< $@
%_$(ARCH).elf: %_$(ARCH).s
$(AS) -o $@ $<
clean:
rm -f $(PROG) $(OBJS) $(BINS)