-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
37 lines (27 loc) · 711 Bytes
/
Makefile
File metadata and controls
37 lines (27 loc) · 711 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
# Name of the executable
TARGET = bytecomp
# Compiler flags
CFLAGS = -Wall -g -O3
# Linker flags (include -lm for math functions)
LDFLAGS = -lm
# All object files
OBJS = bytecomp.o
# Installation directory (change this if needed)
PREFIX = /usr/local
# Default target (build the executable)
all: $(TARGET)
# Rule to build the executable
$(TARGET): $(OBJS)
$(CC) $(OBJS) -o $@ $(LDFLAGS)
# Rule to compile source files into object files
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
# Install target
install: $(TARGET)
install -D $(TARGET) $(PREFIX)/bin/$(TARGET)
# Clean target (remove object files and executable)
clean:
rm -f $(OBJS) $(TARGET)
# Uninstall target
uninstall:
rm -f $(PREFIX)/bin/$(TARGET)