-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
43 lines (32 loc) · 1015 Bytes
/
Makefile
File metadata and controls
43 lines (32 loc) · 1015 Bytes
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
# Makefile for Lexical Analyzer Project
#
# THIS FILE IS MOSTLY WRITTEN BY CLAUDE
# Compiler and flags
CXX = clang++
CXXFLAGS = -std=c++17 -Wall -Wextra -g
LDFLAGS =
# Source files
SOURCES = state.cpp NFA.cpp regex_parser.cpp ThompsonConstructor.cpp DFA.cpp SubsetConstructor.cpp Lexer.cpp
HEADERS = state.h NFA.h regex_parser.h ThompsonConstructor.h DFA.h SubsetConstructor.h Lexer.h
# Object files (created from source files)
OBJECTS = $(SOURCES:.cpp=.o)
# Target executable
TARGET = lexical_analyzer
# Default target - build the executable
all: $(TARGET)
# Rule to build the executable from object files
$(TARGET): $(OBJECTS) main.o
$(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS)
# Rule to create object files from .cpp source files
%.o: %.cpp $(HEADERS)
$(CXX) $(CXXFLAGS) -c $< -o $@
# Run the program
run: $(TARGET)
./$(TARGET)
# Clean up compiled files
clean:
rm -f $(OBJECTS) main.o $(TARGET)
# Rebuild from scratch
rebuild: clean all
# Phony targets (not actual files)
.PHONY: all run clean rebuild