36 lines
693 B
Makefile
36 lines
693 B
Makefile
##
|
|
# TH WWS
|
|
#
|
|
# @file
|
|
# @version 0.1
|
|
CC = gcc
|
|
CFLAGS ?= -Wall -Wextra -Iinclude -fomit-frame-pointer -O2
|
|
|
|
SRC_DIR = src
|
|
INCLUDE_DIR = include
|
|
BUILD_DIR = build
|
|
TARGET = WWS_System
|
|
|
|
SRC_FILES = $(wildcard $(SRC_DIR)/*.c)
|
|
OBJ_FILES = $(patsubst $(SRC_DIR)/%.c, $(BUILD_DIR)/%.o, $(SRC_FILES))
|
|
|
|
.PHONY: all clean
|
|
|
|
all: $(BUILD_DIR) $(TARGET)
|
|
|
|
# Link all the files into the final executable
|
|
$(TARGET): $(OBJ_FILES)
|
|
$(CC) $(OBJ_FILES) -o $@
|
|
|
|
# Compile source- and object files
|
|
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c | $(BUILD_DIR)
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
#Ensure the build directory exists
|
|
$(BUILD_DIR):
|
|
mkdir -p $(BUILD_DIR)
|
|
|
|
# Clean build and target
|
|
clean:
|
|
rm -Rf $(BUILD_DIR) $(TARGET)
|
|
# end
|