Skip to content

Commit 0022e3d

Browse files
authored
Merge pull request #4 from sanjayankur31/feature/makefile-cflags
Feature/makefile cflags
2 parents 75da8bd + 72e15e8 commit 0022e3d

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

makefile

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
1-
CC=g++
2-
#CFLAGS = -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)"
3-
CFLAGS = -O0 -g3 -Wall
1+
CXX=g++
2+
#CXXFLAGS = -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)"
3+
# If run as DEBUG=1 make, it adds these flags, otherwise it simply uses flags from the environment
4+
ifeq ($(DEBUG), 1)
5+
CXXFLAGS := $(CXXFLAGS) -O0 -g3 -Wall -fmessage-length=0
6+
endif
47

5-
SRCS = ./sources/Archive.cpp ./sources/Attribute.cpp ./sources/DESolver.cpp ./sources/Evaluate.cpp ./sources/Feature.cpp ./sources/Problem.cpp ./sources/Rule.cpp ./sources/Setup.cpp ./sources/uARMSolver.cpp
8+
SRCS = ./sources/Archive.cpp ./sources/Attribute.cpp ./sources/DESolver.cpp ./sources/Evaluate.cpp ./sources/Feature.cpp ./sources/Problem.cpp ./sources/Rule.cpp ./sources/Setup.cpp ./sources/uARMSolver.cpp
69

7-
DEPS = ./Archive.d ./Attribute.d ./DESolver.d ./Evaluate.d ./Feature.d ./Problem.d ./Rule.d ./Setup.d ./uARMSolver.d
10+
DEPS = ./Archive.d ./Attribute.d ./DESolver.d ./Evaluate.d ./Feature.d ./Problem.d ./Rule.d ./Setup.d ./uARMSolver.d
811

9-
OBJS = ./Archive.o ./Attribute.o ./DESolver.o ./Evaluate.o ./Feature.o ./Problem.o ./Rule.o ./Setup.o ./uARMSolver.o
12+
OBJS = ./Archive.o ./Attribute.o ./DESolver.o ./Evaluate.o ./Feature.o ./Problem.o ./Rule.o ./Setup.o ./uARMSolver.o
1013

1114
all: bin/uARMSolver
1215

1316
bin/uARMSolver: $(OBJS)
1417
@echo 'Invoking: GCC C++ Linker'
15-
$(CC) -o $@ $^
18+
$(CXX) $(LDFLAGS) -o $@ $^
1619
@echo 'Finished building: $<'
1720
rm -fr $(OBJS) $(DEPS)
1821

19-
%.o: ./sources/%.cpp
22+
%.o: ./sources/%.cpp
2023
@echo 'Invoking: GCC C++ Compiler'
21-
$(CC) -I./sources -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
24+
$(CXX) -I./sources $(CXXFLAGS) -c -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
2225
@echo 'Finished building: $<'
2326

2427
clean:

0 commit comments

Comments
 (0)