diff --git a/source/linux/Makefile b/source/linux/Makefile index cdbd8b7f49..27c149d2c1 100755 --- a/source/linux/Makefile +++ b/source/linux/Makefile @@ -43,13 +43,24 @@ LIB_OBJS=$(patsubst %.cpp, $(OBJDIR)/%.o, $(LIB_SOURCES)) DEP_SOURCES=$(PS_SOURCES) $(PS_NET_SOURCES) $(GUI_SOURCES) $(LIB_SOURCES) $(TERR_SOURCES) -.PHONY: clean all Makefile MPT +.PHONY: clean all MPT run runMPT prof runProf all: .banner $(BINDIR)/prometheus +prof: $(BINDIR)/prometheus.prof + clean: rm -fr deps o +run: $(BINDIR)/prometheus + pushd $(BINDIR); ./prometheus; popd + +runProf: $(BINDIR)/prometheus-prof + pushd $(BINDIR); ./prometheus.prof; popd + +runMPT: $(BINDIR)/MessagePassingTest + pushd $(BINDIR); ./MessagePassingTest; popd + include $(patsubst %, $(DEPDIR)/%.d, $(DEP_SOURCES)) .banner: @@ -73,15 +84,31 @@ $(BINDIR)/MessagePassingTest: \ MPT: $(BINDIR)/MessagePassingTest -$(BINDIR)/prometheus: $(OBJDIR)/main.o $(PS_OBJS) $(LIB_OBJS) $(GUI_OBJS) $(TERR_OBJS) +prometheus_OBJS=$(OBJDIR)/main.o \ + $(PS_OBJS) \ + $(PS_NET_OBJS) \ + $(LIB_OBJS) \ + $(GUI_OBJS) \ + $(TERR_OBJS) + +$(BINDIR)/prometheus: $(prometheus_OBJS) @mkdir -p $(dir $@) $(CXX) $(LDFLAGS) -o $@ $^ +$(BINDIR)/prometheus.prof: $(patsubst %.o, %.prof.o, $(prometheus_OBJS)) + @mkdir -p $(dir $@) + $(CXX) $(LDFLAGS) -pg -o $@ $^ + $(OBJDIR)/%.o: $(SRCDIR)/%.cpp @mkdir -p $(dir $@) @echo : $@ @$(CXX) $(CPPFLAGS) $(CFLAGS) $(CXXFLAGS) -c -o $@ $< +$(OBJDIR)/%.prof.o: $(SRCDIR)/%.cpp + @mkdir -p $(dir $@) + @echo : $@ + @$(CXX) $(CPPFLAGS) $(CFLAGS) $(CXXFLAGS) -pg -c -o $@ $< + $(SRCDIR)/%.ii: $(SRCDIR)/%.cpp @echo Generating preprocessed file $(notdir $<).ii $(CXX) $(CPPFLAGS) $(CXXFLAGS) -E -o $(notdir $<).ii $< diff --git a/source/linux/readme.txt b/source/linux/readme.txt index 6c8bf45e76..c0e75b5cc4 100755 --- a/source/linux/readme.txt +++ b/source/linux/readme.txt @@ -22,3 +22,12 @@ binaries/: The built binaries - called "prometheus" source/linux/deps/: Automatically generated dependency information for all source files source/linux/o/: Object files + +Makefile Targets: + +all (default): build the prometheus executable +prof: build the prometheus.prof executable (instrumented version with call-counting) +clean: Remove all object, depend, and executable files + +run: build prometheus and run it (from the binaries directory) +runProf: build prometheus.prof and run it