calc/Makefile

65 lines
1.2 KiB
Makefile
Raw Normal View History

2024-03-08 15:27:04 +01:00
CXX=g++
LD=g++
CXXFLAGS=-Wall -pedantic -Wextra -g
DBGFLAGS=-g
SRC_DIR=src/code/
BUILD_DIR=build/
TARGET=hladuond
SRC = $(wildcard src/code/*.cpp)
OBJ = $(SRC:src/code/%.cpp=build/%.o)
.PHONY: all
all: compile doc
.PHONY: run
run: hladuond
./hladuond
doc: doc/html
doc/html:
doxygen Doxyfile
cp ./doc/html/index.html ./doc/index.html
compile:
mkdir -p $(BUILD_DIR)
$(MAKE) -j8 hladuond
test:
mkdir -p $(BUILD_DIR)
$(MAKE) -j8 examples/test
examples/test: build/test.o $(filter-out $(BUILD_DIR)main.o, $(OBJ))
$(LD) $(CXXFLAGS) -o $@ $^
# link
$(TARGET): $(OBJ)
$(LD) $(CXXFLAGS) -o $@ $^
# compile
$(BUILD_DIR)%.o: $(SRC_DIR)%.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<
build/test.o: examples/test.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<
.PHONY: clean
clean:
rm -rf hladuond
rm -f hladuond.zip
rm -rf ./build
rm -rf ./doc/html ./doc/index.html
rm -f Makefile.d
rm -f ./examples/test
progtest: clean
mkdir hladuond
cp -r src hladuond/src
cp -r doc hladuond/doc
cp -r examples hladuond/examples
cp README.md hladuond/README.md
cp prohlaseni.txt hladuond/prohlaseni.txt
cp zadani.txt hladuond/zadani.txt
cp Doxyfile hladuond/Doxyfile
cp Makefile hladuond/Makefile
zip -r hladuond.zip hladuond/
rm -rf hladuond