-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
34 lines (24 loc) · 850 Bytes
/
Makefile
File metadata and controls
34 lines (24 loc) · 850 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
# Compiler
CC = gcc
# Compiler flags
CFLAGS = -Wall -g
# Source directory
SRC_DIR = src
# Target executable name
TARGET = void_shell
# Source files
SRCS = $(SRC_DIR)/main.c $(SRC_DIR)/execute_ls.c $(SRC_DIR)/execute_pwd.c $(SRC_DIR)/execute_cd.c $(SRC_DIR)/execute_exit.c $(SRC_DIR)/execute_touch.c $(SRC_DIR)/execute_cat.c $(SRC_DIR)/execute_echo.c $(SRC_DIR)/execute_psinfo.c $(SRC_DIR)/execute_remindme.c
# Object files (for each source file)
OBJS = $(SRCS:.c=.o)
# Default target: build the executable
all: $(TARGET)
# Rule for linking object files into the final executable
$(TARGET): $(OBJS)
$(CC) $(CFLAGS) -o $@ $^
# Rule for compiling each .c file to .o file
$(SRC_DIR)/%.o: $(SRC_DIR)/%.c
$(CC) $(CFLAGS) -c $< -o $@
# Clean rule: remove object files and the executable
clean:
rm -f $(SRC_DIR)/*.o $(TARGET)
.PHONY: all clean