-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
36 lines (28 loc) · 783 Bytes
/
Makefile
File metadata and controls
36 lines (28 loc) · 783 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
# Compiler and flags
CC = gcc
CFLAGS = -Wall
# Executable name
TARGET = dragonshell
# Source files
SRCS = dragonshell.c \
commands/built_in.c \
commands/external.c \
special/background.c \
special/ioRedirect.c \
special/pipe.c \
utils/jobs.c
# Object files (replace .c with .o)
OBJS = $(SRCS:.c=.o)
# Main target: link all object files to create executable
dragonshell: $(OBJS)
$(CC) $(LDFLAGS) -o $(TARGET) $(OBJS)
# Compile target: compile all source files to object files
compile: $(OBJS)
# Pattern rule for compiling .c files to .o files
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
# Clean target: remove object files and executable
clean:
rm -f $(OBJS) $(TARGET)
# Phony targets (not actual files)
.PHONY: dragonshell compile clean