blob: 5233213183181e4a7b47880f3322ab840397580d (
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
|
P = nios2sim-ng
VERSION = 0.1
OBJS = main.o image.o elf.o srec.o
#OBJS += load_image.o nor_flash.o simulator.o simulator.o niosii.o i_type_handler.o j_type_handler.o \
# r_type_handler.o custom_instr.o io_device.o jtag_uart.o timer.o uart_core.o
DEFS = -DVERSION="\"$(VERSION)\"" -DDEBUG
CFLAGS += -g -W -Wall $(DEFS)
LDFLAGS += -lelf
all: prepare $(P)
prepare:
@mkdir -p .deps
$(P): $(OBJS)
@echo LD $@
@$(CC) $(LDFLAGS) -o $@ $^
-include $(addprefix .deps/,$(OBJS:.o=.o.dep))
%.o: %.c %.h
@echo CC $@
@$(CC) $(CFLAGS) -c $< -o $@
@$(CC) -MM $(CFLAGS) $< > $(addprefix .deps/,$@.dep)
%.o: %.c
@echo CC $@
@$(CC) $(CFLAGS) -c $< -o $@
@$(CC) -MM $(CFLAGS) $< > $(addprefix .deps/,$@.dep)
clean:
@echo CLEAN
@rm -rf .deps
@rm -rf $(P) *.o
distclean: clean
@echo DISTCLEAN
@rm -rf *~
@rm -rf #*
@rm -rf tags
|