This assignment is worth 5 points.
CXXFLAGS = -g -O3 -Wpedantic -Wall -Wextra -Wmisleading-indentation -Wunused -Wuninitialized -Wshadow -Wconversion -D_GLIBCXX_ASSERTIONS -std=c++17
#include <iostream>
using namespace std;
int main() {
int i;
while (i < 10) {
int i = 4;
i += i;
cout << " i = " << i << endl;
}
return 0;
}
g++ -o hw2a hw2a.cpp
rm hw2a
make -n hw2a
make: 'hw2a' is up to date. you need to remove the executable hw2a as directed above.
make hw2a
#include <iostream>
using namespace std;
int main() {
int i;
while (i < 10)
cout << i << endl;
i++;
return 0;
}
g++ -o hw2b hw2b.cpp) to assure yourself it compiles without errors.
g++ -o hw2b -Wmisleading-indentation hw2b.cpp
make hw2b
rm hw2b
make What happens?
CXXFLAGS = -g -O3 -Wpedantic -Wall -Wextra -Wmisleading-indentation -Wunused -Wuninitialized -Wshadow -Wconversion -D_GLIBCXX_ASSERTIONS -std=c++17 all: hw2a
make What happens?
all: hw2a we declared a default target. (I am sort of lying, but it will do).
all: hw2a hw2b hw2c
OBJS = hw2a hw2b hw2c
CXXFLAGS = -g -O3 -Wpedantic -Wall -Wextra -Wmisleading-indentation -Wunused -Wuninitialized -Wshadow -Wconversion -D_GLIBCXX_ASSERTIONS -std=c++17
all: ${OBJS}
OBJS = hw2a hw2b hw2c
CXXFLAGS = -g -O3 -Wpedantic -Wall -Wextra -Wmisleading-indentation -Wunused -Wuninitialized -Wshadow -Wconversion -D_GLIBCXX_ASSERTIONS -std=c++17
all: ${OBJS}
clean:
rm -f ${OBJS}
make clean