-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
71 lines (51 loc) · 999 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
60
61
62
63
64
65
66
67
68
69
70
71
#
# nicer
#
# @file
# @version 0.1
NAME := nicer
# Commands:
RM := rm -f
# Flags for "make" itself
MAKEFLAGS += --no-print-directory
DIR_DUP = mkdir -p $(@D)
##################
# # Sources, etc #
##################
SRCDIR = src
BUILDDIR = build
# Source files
SRCS = $(wildcard src/*.c)
# SRCS = $(wildcard $(SRCDIR)/**/*.c)
# Object files
OBJS = $(addprefix build/,$(notdir $(SRCS:.c=.o)))
# OBJS = $(patsubst $(SRCDIR)/%.c,$(BUILDDIR)/%.o,$(SRCS))
# Compiler options
CFLAGS := -Wall -g3 -O0 -std=c11 -Wextra -Wunused -pedantic
CPPFLAGS := -MMD -MP -I include
# Compiler
CC = gcc
#############
# # Targets #
#############
# default target
all: build/nicer
build/nicer: $(OBJS)
$(CC) $(CFLAGS) -o $@ $^
$(info CREATED $(NAME))
build/%.o: src/%.c
$(DIR_DUP)
$(CC) $(CFLAGS) -c -o $@ $<
$(info CREATED $@)
# Cleans build directory
clean:
$(RM) $(OBJS)
fclean: clean
$(RM) $(NAME)
run:
$(MAKE) fclean
bear -- make all
./build/nicer
.PHONY: clean fclean
.SILENT:
# end