aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: ad7f879176761af048e57069884fb20ed1ef2bf8 (plain)
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
54
55
56
57
58
59
###############################################################################
# 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) -U$(ARCH) $(BUILD_INC) $(CFLAGS) $(EXTRA_CFLAGS)

PROG=risu
SRCS=risu.c comms.c risu_$(ARCH).c risu_reginfo_$(ARCH).c
HDRS=risu.h risu_reginfo_$(ARCH).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 $@ $<

%_$(ARCH).elf: %_$(ARCH).S
	$(CC) $(CPPFLAGS) -o $@ -c $<

clean:
	rm -f $(PROG) $(OBJS) $(BINS)

distclean: clean
	rm -f config.h Makefile.in