forked from BytesClub/chalk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
59 lines (46 loc) · 992 Bytes
/
Makefile
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#################################
# Makefile #
# Build Recipie for Executable #
# #
# Author: Progyan Bhattacharya #
# Maintainer: Bytes Club #
#################################
# Define Compiler
CC=gcc
# Compiler Flags
CFLAGS=-Wall -Werror -Wextra -pedantic -std=c11
# Linker Flags
LFLAGS=
# Executable
PROG=chalk
EXE=$(BIN)/$(PROG)
# Directories
BIN=build
INC=inc
SRC=src
# Header File(s)
HEADERS=$(wildcard $(INC)/*.h)
# Source File(s)
SOURCES=$(wildcard $(SRC)/*.c)
# Object File(s)
OBJECTS=$(addprefix $(BIN)/, $(notdir $(SOURCES:.c=.o)))
# Default Target
all: $(EXE)
.PHONY: all
# Target Executable and Objects
$(EXE): $(OBJECTS)
@mkdir -p $(BIN)
$(CC) $^ -o $@
$(BIN)/%.o: $(SRC)/%.c $(HEADERS)
@mkdir -p $(BIN)
$(CC) $(CFLAGS) -I$(INC) -c $< -o $@
# Help Option
help:
@echo "Header Files: $(HEADERS)"
@echo "Source Files: $(SOURCES)"
@echo "Objects: $(OBJECTS)"
.PHONY: help
# House-keeping
clean:
rm -rf core $(EXE) $(BIN) *.o *.exe
.PHONY: clean