-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
96 lines (79 loc) · 2.87 KB
/
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# Copyright (c) 2020 Marek Benc <dusxmt@gmx.com>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#
# This Makefile is written in a way to be POSIX compliant. It optionally
# supports gcc-generated dependency information, which can be generated
# by invoking "make CC=gcc depend-update" and enabled by uncommenting
# the `include Makefile.deps' line near the end of the file.
#
# Operate in POSIX mode:
#
.POSIX:
# Support .o (object files), .c (C code files), and .dep (dependency files):
#
.SUFFIXES:
.SUFFIXES: .o .c .dep
# Global settings:
#
CC = cc
CPPFLAGS =
CFLAGS = -std=c89 -pedantic -Wall -Wextra -W
LDFLAGS =
LIBS =
# Argument library demo:
#
ARGS_DEMO = dooshki_args_demo
ARGS_DEMO_LIBS =
ARGS_DEMO_SRCS = dooshki_args.c dooshki_args_demo.c
ARGS_DEMO_OBJS = $(ARGS_DEMO_SRCS:.c=.o)
$(ARGS_DEMO): $(ARGS_DEMO_OBJS)
$(CC) $(LDFLAGS) -o $@ $(ARGS_DEMO_OBJS) $(ARGS_DEMO_LIBS) $(LIBS)
# Build folder clean-up rule:
#
clean:
rm -f $(ARGS_DEMO_OBJS) $(ARGS_DEMO)
# C file compilation rule:
#
.c.o:
$(CC) $(CPPFLAGS) $(CFLAGS) -c $<
# Header dependency information generated by gcc:
#
#
# Uncomment the following line to enable the use of gcc-generated dependency
# information, which is useful mainly when working on the code, as it ensures
# that whenever the header files are modified, any code files that use them
# are automatically re-compiled upon "make" being invoked, and that those code
# files that aren't affected aren't needlessly re-compiled.
#
# This dependency information has to be manually updated whenever #include<>
# statements are changed in the code by invoking "make CC=gcc depend-update",
# to make sure the dependency information used by make is up-to-date.
#
# This file is intentionally not deleted by "make clean", as it's indended
# to fulfill the role of the hand-written dependency information traditionally
# present in Makefiles, providing a less error-prone alternative.
#
#include Makefile.deps
# Intermediate dependency files:
#
DEPFILES = $(ARGS_DEMO_SRCS:.c=.dep)
# Generation rule for the intermediate dependency files from C code files:
#
.c.dep:
$(CC) $(CPPFLAGS) $(CFLAGS) -MM $< -MF $@
# Dependency file update rule:
#
depend-update: $(DEPFILES)
cat $(DEPFILES) > Makefile.deps
rm -f $(DEPFILES)