new to using Makefiles and was wondering how I would include the -g command (and anything else I need) in order to compile my program to be run with gdb. Here is the Makefile I was given. Thanks in advance.
include parallelDefs
COMMON = dataGen.h utils.h IO.h parseCommandLine.h graph.h graphIO.h graphUtils.h parallel.h sequence.h blockRadixSort.h deterministicHash.h transpose.h
GENERATORS = rMatGraph gridGraph powerGraph randLocalGraph addWeights randDoubleVector fromAdjIdx adjToEdgeArray adjElimSelfEdges
.PHONY: all clean
all: $(GENERATORS)
$(COMMON) :
ln -s ../../common/$@ .
%.o : %.C $(COMMON)
$(PCC) $(PCFLAGS) -c $< -o $@
rMatGraph : rMatGraph.o
$(PCC) $(PLFLAGS) -o $@ rMatGraph.o
gridGraph : gridGraph.o
$(PCC) $(PLFLAGS) -o $@ gridGraph.o
powerGraph : powerGraph.o
$(PCC) $(PLFLAGS) -o $@ powerGraph.o
randLocalGraph : randLocalGraph.o
$(PCC) $(PLFLAGS) -o $@ randLocalGraph.o
addWeights : addWeights.o
$(PCC) $(PLFLAGS) -o $@ addWeights.o
fromAdjIdx : fromAdjIdx.o
$(PCC) $(PLFLAGS) -o $@ fromAdjIdx.o
randDoubleVector : randDoubleVector.o
$(PCC) $(PLFLAGS) -o $@ randDoubleVector.o
adjToEdgeArray : adjToEdgeArray.C $(COMMON)
$(PCC) $(PCFLAGS) $(PLFLAGS) -o $@ adjToEdgeArray.C
adjElimSelfEdges : adjElimSelfEdges.C $(COMMON)
$(PCC) $(PCFLAGS) $(PLFLAGS) -o $@ adjElimSelfEdges.C
clean :
rm -f *.o $(GENERATORS)
make clean -s -C data
cleansrc :
make -s clean
rm -f $(COMMON)
If only randLocalGraph
should be compiled with the -g
option, then it will need an explicit rule:
randLocalGraph.o: randLocalGraph.C $(COMMON)
$(PCC) $(PCFLAGS) -g -c randLocalGraph.C -o $@
All the other objects will be created using the implicit rule.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.