scl/Makefile

30 lines
765 B
Makefile
Raw Normal View History

2024-09-28 09:31:23 -04:00
NAME = scl
2024-09-28 09:38:01 -04:00
CC = clang
CFLAGS = -Wall --std=c11
LDFLAGS =
2024-09-28 09:31:23 -04:00
SRC_DIR = src
OBJ_DIR = obj
TARGET = $(NAME).out
SRC_FILES = $(wildcard $(SRC_DIR)/*.c)
OBJ_FILES = $(patsubst $(SRC_DIR)/%.c, $(OBJ_DIR)/%.o, $(SRC_FILES))
2024-09-28 09:38:01 -04:00
all: $(TARGET)
2024-09-28 09:31:23 -04:00
2024-09-28 09:38:01 -04:00
$(TARGET): $(OBJ_FILES)
@ echo -e "\x1b[32;1mLinking \x1b[0m\x1b[32m$(TARGET)\x1b[32;1m...\x1b[0m\x1b[37m $(CC) -o $(TARGET) $(OBJ_FILES) $(LDFLAGS)\x1b[0m"
@ $(CC) -o $(TARGET) $(OBJ_FILES) $(LDFLAGS)
2024-09-28 09:31:23 -04:00
2024-09-28 09:38:01 -04:00
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c $(SRC_DIR)/include/%.h
2024-09-28 09:31:23 -04:00
@ mkdir -p $(OBJ_DIR)
2024-09-28 09:38:01 -04:00
@ echo -e "\x1b[32;1mCompiling \x1b[0m\x1b[32m$<\x1b[32;1m... \x1b[0m\x1b[37m$(CC) $(CFLAGS) -c $< -o $@\x1b[0m"
@ $(CC) $(CFLAGS) -c $< -o $@
2024-09-28 09:31:23 -04:00
2024-09-28 09:38:01 -04:00
clean:
@ echo -e "\x1b[32;1mCleaning up...\x1b[0m"
@ rm -rf $(OBJ_DIR) $(TARGET)
2024-09-28 09:31:23 -04:00
2024-09-28 09:38:01 -04:00
.PHONY: all clean