-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
60 lines (46 loc) · 1.23 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#Makefile
#compiler=C++
PROJECT_NAME=CDCL_Solver
CXX=g++32
DEBUGGER=gdb32
SRC=src
INC=-I. -I./Include
LIB=-L.
OBJ=obj
BIN=bin
COMPILELOG=log/compile-log
LINKLOG=log/link-log
srcv:=src/
Flags=-g -Wall -fexceptions -std=c++17 #-lstdc++fs
links=
include_state=\#include
.PHONY= run,test,build,debug-run
#compile to object files
%.o: $(SRC)/%.cpp
$(CXX) $(Flags) $(INC) -c $< -o $(OBJ)/$@ 2>$(COMPILELOG)/$(patsubst %.o,%,$@).ccpp
#link all to exe
objfiles=$(wildcard $(OBJ)/*.o)
%.exe: $(objfiles)
$(CXX) $(LIB) -o $(BIN)/$@ $(objfiles) $(links) 2>$(LINKLOG)/$(patsubst %.exe,%,$@).ccpp
build:
$(MAKE) $(PROJECT_NAME).exe
#compile all
srcf=$(wildcard $(SRC)/*.cpp)
sources=$(patsubst %.cpp,%.o,$(srcf))
source=$(subst src/,,$(sources))
compileall: $(source)
$($^)
build-dll:
$(CXX) $(Flags) $(INC) -shared -o $(PROJECT_NAME).dll $(srcf) 2>log/DLL_export/dllexport.ccpp
#create .cpp file for the header with the same name
%.h:
echo $(patsubst \#,#,$(include_state))"$@" > $(SRC)/$(patsubst %.h,%.cpp,$@)
compilelist=$(wildcard $(COMPILELOG)/*.ccpp)
compiles=$(subst $(COMPILELOG)/,,$(compilelist))
#cleans all compile logs
%.ccpp:
echo Log Cleared > $(COMPILELOG)/$@
clearcompile: $(compiles)
$($^)
test:
$(DEBUGGER) $(BIN)/$(PROJECT_NAME).exe