diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 46 |
1 files changed, 32 insertions, 14 deletions
@@ -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 |