P = nios2sim-ng VERSION = 0.1 OBJS = main.o image.o elf.o srec.o nios2.o instruction.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 -Wno-packed-bitfield-compat $(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