summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2010-11-10 17:10:07 +0100
committerTobias Klauser <tklauser@distanz.ch>2010-11-10 17:10:07 +0100
commit3cb7c05906b8eb8e884013b441f352256fded011 (patch)
tree4061936126e43746ed5d6157ead0eb778b256beb /Makefile
parent32f507ce5f66dd9c89a45854688f46bde33c5e3d (diff)
First bunch of rework, stil work in progress
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile46
1 files changed, 32 insertions, 14 deletions
diff --git a/Makefile b/Makefile
index a2f4ad9..5233213 100644
--- a/Makefile
+++ b/Makefile
@@ -1,25 +1,43 @@
-#
-# Make file for compiling simulator for NIOSII
-#
+P = nios2sim-ng
+VERSION = 0.1
-TARGET=nios-sim
+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
-SRC=main.c load_image.c simulator.c niosii.c i_type_handler.c j_type_handler.c \
- r_type_handler.c custom_instr.c io_device.c jtag_uart.c timer.c uart_core.c \
- nor_flash.c
+DEFS = -DVERSION="\"$(VERSION)\"" -DDEBUG
-CFLAGS= -g -Wall
+CFLAGS += -g -W -Wall $(DEFS)
+LDFLAGS += -lelf
-all:
- gcc -o ${TARGET} ${CFLAGS} ${SRC}
+all: prepare $(P)
-.phony:
- clean distclean
+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:
- @rm -rf ${TARGET} *.o
+ @echo CLEAN
+ @rm -rf .deps
+ @rm -rf $(P) *.o
distclean: clean
+ @echo DISTCLEAN
@rm -rf *~
@rm -rf #*
- @rm -rf tags \ No newline at end of file
+ @rm -rf tags