forked from lyh552506/miniC-compiler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
32 lines (24 loc) · 762 Bytes
/
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
# Compiler and flags
CXX = clang++
CXXFLAGS = -std=c++20 -O2 -lm -lpthread -L/extlibs -g
INCLUDES = -I/extlibs -I./util -I./include/backend -I./include/yacc -I./include/lib -I./include/ir/opt -I./include/Analysis
# Directories to search for source files
SRC_DIRS = ./lib ./yacc ./backend ./ir/opt ./ir/Analysis
# Output executable
TARGET = ./compiler
# Find all .cpp files in the specified directories
SRCS = $(shell find $(SRC_DIRS) -name '*.cpp')
SRCS += ./main.cpp
# OBJS = $(SRCS:.cpp=.o)
# Default target
all: $(TARGET)
# Link the executable
$(TARGET): $(OBJS)
$(CXX) $(CXXFLAGS) $(SRCS) $(INCLUDES) -o $@
# Compile each .cpp file to .o
# %.o: %.cpp
# $(CXX) $(CXXFLAGS) $(INCLUDES) -c $< -o $@
# Clean up
clean:
rm -f $(TARGET)
.PHONY: all clean