571b5b2093
If you have multi-target rules that don't have %s in them, make interprets that as "run this recipe multiple times, once to produce each target". If you have %s in the rules, then make interprets it as "run this recipe once to produce all targets". We want the second one.
41 lines
2.3 KiB
Plaintext
41 lines
2.3 KiB
Plaintext
#--------------------------------------------------------------------
|
|
# Chisel Emulator Generation
|
|
#--------------------------------------------------------------------
|
|
OBJS := $(addsuffix .o,$(CXXSRCS) $(MODEL).$(CONFIG))
|
|
DEBUG_OBJS := $(addsuffix .debug.o,$(CXXSRCS) $(MODEL).$(CONFIG))
|
|
|
|
model_header = $(generated_dir)/$(MODEL).$(CONFIG).h
|
|
model_header_debug = $(generated_dir_debug)/$(MODEL).$(CONFIG).h
|
|
|
|
$(MODEL).$(CONFIG).o: %.o: $(generated_dir)/%.h
|
|
$(MAKE) -j $(patsubst %.cpp,%.o,$(shell ls $(generated_dir)/$(MODEL).$(CONFIG)-*.cpp))
|
|
$(LD) -r $(patsubst %.cpp,%.o,$(shell ls $(generated_dir)/$(MODEL).$(CONFIG)-*.cpp)) -o $@
|
|
|
|
$(MODEL).$(CONFIG).debug.o: %.debug.o: $(generated_dir_debug)/%.h
|
|
$(MAKE) -j $(patsubst %.cpp,%.o,$(shell ls $(generated_dir_debug)/$(MODEL).$(CONFIG)-*.cpp))
|
|
$(LD) -r $(patsubst %.cpp,%.o,$(shell ls $(generated_dir_debug)/$(MODEL).$(CONFIG)-*.cpp)) -o $@
|
|
|
|
$(generated_dir)/%.o: $(generated_dir)/%.cpp $(generated_dir)/%.h
|
|
$(CXX) $(CXXFLAGS) -I$(generated_dir) -c -o $@ $<
|
|
|
|
$(generated_dir_debug)/%.o: $(generated_dir_debug)/%.cpp $(generated_dir_debug)/%.h
|
|
$(CXX) $(CXXFLAGS) -I$(generated_dir_debug) -c -o $@ $<
|
|
|
|
$(addsuffix .o,$(CXXSRCS)): %.o: $(base_dir)/csrc/%.cc $(base_dir)/csrc/*.h $(model_header) $(consts_header)
|
|
$(CXX) $(CXXFLAGS) -include $(scr_header) -include $(model_header) -include $(consts_header) -I$(generated_dir) -c -o $@ $<
|
|
|
|
$(addsuffix .debug.o,$(CXXSRCS)): %.debug.o: $(base_dir)/csrc/%.cc $(base_dir)/csrc/*.h $(model_header_debug) $(consts_header_debug)
|
|
$(CXX) $(CXXFLAGS) -include $(scr_header_debug) -include $(model_header_debug) -include $(consts_header_debug) -I$(generated_dir_debug) -c -o $@ $<
|
|
|
|
$(generated_dir)/%.$(CONFIG).d $(generated_dir)/%.$(CONFIG).h $(generated_dir)/%.$(CONFIG).prm: $(chisel_srcs)
|
|
cd $(base_dir) && $(SBT) "project $(PROJECT)" "run $(CHISEL_ARGS) --noIoDebug"
|
|
|
|
$(generated_dir_debug)/%.$(CONFIG).d $(generated_dir_debug)/%.$(CONFIG).h $(generated_dir_debug)/%.$(CONFIG).prm: $(chisel_srcs)
|
|
cd $(base_dir) && $(SBT) "project $(PROJECT)" "run $(CHISEL_ARGS)-debug --debug --vcd --ioDebug"
|
|
|
|
$(emu): $(model_header) $(OBJS) libdramsim.a
|
|
$(CXX) $(CXXFLAGS) -o $@ $(OBJS) $(LDFLAGS)
|
|
|
|
$(emu_debug): $(generated_dir)/$(MODEL).$(CONFIG).d $(model_header_debug) $(DEBUG_OBJS) libdramsim.a
|
|
$(CXX) $(CXXFLAGS) -o $@ $(DEBUG_OBJS) $(LDFLAGS)
|