-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
30 lines (21 loc) · 695 Bytes
/
Copy pathMakefile
File metadata and controls
30 lines (21 loc) · 695 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
CC = gcc
CFLAGS = -Wall -Wextra -std=c99 -Iinclude
TARGET = shell.out
SRCDIR = src
INCDIR = include
OBJDIR = obj
SOURCES = $(SRCDIR)/main.c $(SRCDIR)/prompt.c $(SRCDIR)/input.c $(SRCDIR)/parser.c $(SRCDIR)/commands.c $(SRCDIR)/executor.c $(SRCDIR)/redirection.c $(SRCDIR)/pipes.c $(SRCDIR)/background.c $(SRCDIR)/utils.c $(SRCDIR)/signals.c $(SRCDIR)/log.c
OBJECTS = $(SOURCES:$(SRCDIR)/%.c=$(OBJDIR)/%.o)
.PHONY: all clean
all: $(TARGET)
$(TARGET): $(OBJECTS)
$(CC) $(OBJECTS) -o $@
$(OBJDIR)/%.o: $(SRCDIR)/%.c | $(OBJDIR)
$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR):
mkdir -p $(OBJDIR)
clean:
rm -rf $(OBJDIR) $(TARGET)
install: $(TARGET)
cp $(TARGET) /usr/local/bin/
.PHONY: install