Syntax_Error
Syntax_Error

Reputation: 6210

Modifying a makefile

I have the following file from the PARSEC opensource benchmarks, and I want to be able to profile it using gcc. yet as u know i need to raise the -pg flags. yet i am having difficulties doing so. i tried to use a regular g++ -pg -o files.cpp yet it didnt work. i also tried to modify the makefile that infront of the -o i placed a -pg yet it also gave huge errors. So now i am stuck, either I did something wrong or the -pg flags require something special...yet the makefile when executed alone gave me an output which i tested by running and it was successfull! so i am sure the source code is accepted by my compiler

# Makefile for parallel simulated annealer

PREFIX=${PARSECDIR}/pkgs/kernels/canneal/inst/${PARSECPLAT}

TARGET=canneal
LIBS:=$(LIBS) -lm

ifdef version
  ifeq "$(version)" "pthreads"
    CXXFLAGS+=-DENABLE_THREADS -pthread
  endif
endif

all:
    $(CXX) $(CXXFLAGS) annealer_thread.cpp -c -o annealer_thread.o
    $(CXX) $(CXXFLAGS) rng.cpp -c -o rng.o
    $(CXX) $(CXXFLAGS) netlist.cpp -c -o netlist.o
    $(CXX) $(CXXFLAGS) main.cpp -c -o main.o
    $(CXX) $(CXXFLAGS) netlist_elem.cpp -c -o netlist_elem.o
    $(CXX) $(CXXFLAGS) $(LDFLAGS) *.o $(LIBS) -o $(TARGET)

clean:
    rm -f *.o $(TARGET)

install:
    mkdir -p $(PREFIX)/bin
    cp -f $(TARGET) $(PREFIX)/bin/$(TARGET)

Upvotes: 1

Views: 325

Answers (1)

John Carter
John Carter

Reputation: 55271

Try adding this near the top of the file:

CXXFLAGS+= -pg

Upvotes: 2

Related Questions