-
-
Notifications
You must be signed in to change notification settings - Fork 100
Expand file tree
/
Copy pathMakefile.example
More file actions
277 lines (236 loc) · 5.94 KB
/
Copy pathMakefile.example
File metadata and controls
277 lines (236 loc) · 5.94 KB
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
#!/usr/bin/env make
#
# YYYY/XXX <<=== The IOCCC Judges will replace this line
# XXX - remove text below, including this line - XXX
# XXX -
# XXX - Please use this Makefile, renamed as Makefile of course, as the Makefile in
# XXX - your submission. Modify it as needed, including removing this comment and
# XXX - other comments we ask you to remove.
# XXX -
# XXX - remove text above, including this line - XXX
#############################
# shell used by this Makefile
#############################
SHELL= bash
#######################
# common tool locations
#######################
#
# XXX - remove text below, including this line - XXX
# XXX -
# XXX - The IOCCC judges will remove this line and uncomment the next line later
# -include ../var.mk ../../var.mk ../../../var.mk
# XXX -
# XXX - for now, set some common tool locations
# XXX - once var.mk is in use, the IOCCC judges will remove the section below
# XXX -
# XXX - remove text above, including this line - XXX
CC= cc
CHMOD= chmod
CLANG= clang
CLANG_FORMAT= clang-format
CPP= cpp
GCC= gcc
MV= mv
RM= rm
RMDIR= rmdir
TRUE= true
#####################
# C compiler settings
#####################
# Common C compiler warnings to silence
#
# Example: CSILENCE= -Wno-int-conversion -Wno-missing-variable-declarations -Wno-missing-prototypes
#
CSILENCE=
# Attempt to silence unknown warning options
#
CUNKNOWN= -Wno-unknown-warning-option
# Common C compiler warning flags
#
# XXX - remove text below, including this line - XXX
# XXX -
# XXX - NOTE: The addition of -pedantic to CWARN is a challenge that
# XXX - You may wish to avoid if it proves too problematic.
# XXX - There is NO penalty for removing -pedantic from CWARN.
# XXX -
# XXX - remove text above, including this line - XXX
#
CWARN= -Wall -Wextra -pedantic ${CSILENCE} ${CUNKNOWN}
# Compiler standard
#
CSTD= -std=gnu17
# Compiler bit architecture
#
# Example for 32-bitness: ARCH= -m32
# Example for 64-bitness: ARCH= -m64
#
# NOTE: Normally one should NOT specify a specific architecture.
#
ARCH=
# Defines that are needed to compile
#
# Example: -Dfoo -Dbar=baz
#
CDEFINE=
# Include files that are needed to compile
#
# Example: CINCLUDE= -include stdio.h -include stdlib.h -include unistd.h
#
CINCLUDE=
# Other flags to pass to the C compiler
#
# Example: COTHER= -fno-math-errno
#
COTHER=
# Optimization
#
# XXX - remove text below, including this line - XXX
# XXX -
# XXX - NOTE: Feel free to change the level of compiler optimization.
# XXX - The "-O3" is just a friendly default you might wish to try.
# XXX -
# XXX - remove text above, including this line - XXX
#
# Example: OPT= -O0 -ggdb3
#
OPT= -O3
# Default flags for ANSI C compilation
#
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${COTHER} ${OPT}
# Libraries needed to build
#
# Example: LDFLAGS= -lncurses -lm
#
LDFLAGS=
# C compiler to use
# XXX - remove text below, including this line - XXX
# XXX -
# XXX - NOTE: The IOCCC Judges recommend you leave CC as just "cc"
# XXX - and NOT set it to clang, or gcc, or something else
# XXX - unless you have a STRONG reason to do so.
# XXX -
# XXX - Setting CC to something other than "cc" makes your
# XXX - code less portable to those who do not have your
# XXX - particular C compiler. **hint**
# XXX -
# XXX - If you want to test your code with a particular C compiler,
# XXX - use the make command line. For example:
# XXX -
# XXX - make all CC=clang
# XXX - make all CC=gcc
# XXX -
# XXX - remove text above, including this line - XXX
#
CC= cc
# Compiler add-ons or replacements for clang only
#
ifeq "$(findstring $(CLANG),${CC})" "$(CLANG)"
#
# This code is only invoked when CC is "clang"
# such as when you use the make command line:
#
# make all CC=clang
# make all CC=clang-mp-12
#
CSILENCE+=
#
CWARN+= -Weverything
#
endif
# Specific add-ons or replacements for gcc only
#
ifeq "$(findstring $(GCC),${CC})" "$(GCC)"
#
# This code is only invoked when CC is "gcc"
# such as when you use the make command line:
#
# make all CC=gcc
# make all CC=gcc-15
#
CSILENCE+=
#
CWARN+=
#
endif
###########################################
# Special Makefile variables for this entry
###########################################
ENTRY= prog
PROG= ${ENTRY}
#
OBJ= ${PROG}.o
TARGET= ${PROG}
#
# XXX - remove text below, including this line - XXX
# XXX -
# XXX - If there is a prog.alt.c:
# XXX -
# XXX - remove text above, including this line - XXX
#
# ALT_OBJ= ${PROG}.alt.o
# ALT_TARGET= ${PROG}.alt
#
ALT_OBJ=
ALT_TARGET=
# list any data files supplied with your submission
#
# Example: DATA= curds whey
#
DATA=
# XXX - remove text below, including this line - XXX
# XXX -
# Other Makefile variables require by the code
#
# Example: WIDTH= 120
# XXX -
# XXX - Add any new Makefile variables your code might need below.
# XXX -
# XXX - remove text above, including this line - XXX
#################
# build the entry
#################
all: data ${TARGET}
@${TRUE}
.PHONY: all alt data everything clean clobber
# how to compile
#
${PROG}: ${PROG}.c
${CC} ${CFLAGS} ${PROG}.c -o $@ ${LDFLAGS}
# alternative executable
# XXX - remove text below, including this line - XXX
# XXX -
# XXX - remove this entire rule if you do NOT have a alt.prog.c
# XXX -
# XXX - remove text above, including this line - XXX
#
alt: data ${ALT_TARGET}
@${TRUE}
# XXX - remove text below, including this line - XXX
# XXX -
# XXX - remove this entire rule if you do NOT have a alt.prog.c
# XXX -
# XXX - remove text above, including this line - XXX
${PROG}.alt: ${PROG}.alt.c
${CC} ${CFLAGS} ${PROG}.alt.c -o $@ ${LDFLAGS}
# data files
#
data: ${DATA}
@${TRUE}
# both all and alt
#
everything: all alt
@${TRUE}
###############
# utility rules
###############
#
clean:
${RM} -f ${OBJ} ${ALT_OBJ}
clobber: clean
${RM} -f ${TARGET} ${ALT_TARGET}
${RM} -rf *.dSYM
######################################
# optional include of 1337 hacker rulz
######################################
-include 1337.mk ../1337.mk ../../1337.mk