blob: 28c08dff961a5360d1af2a4accc4f468d6d5b569 (
plain)
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
|
CC = gcc
CFLAGS = -Wall -pedantic -Werror -std=c99 -Wfloat-equal -Wundef \
-Wpointer-arith -Wcast-align -Wwrite-strings -Wswitch-default \
-Wconversion -Wfloat-conversion -Wunreachable-code
LDFLAGS = -lm
OBJ = random.o std.o
TARG = $(patsubst %.c,bin/%,$(wildcard exercise*.c)) $(OBJ) NSL_SIMULATOR
# This is specific to my machine and is probably useless for everyone
# else
GUIX_ENVIRONMENT ?= /usr
ifeq (${DEBUG},1)
CFLAGS+=-ggdb -DDEBUG
endif
ifeq (${ASAN},1)
CFLAGS+=-fsanitize=address
endif
ifeq (${TSAN},1)
CFLAGS+=-fsanitize=thread
endif
ifeq (${UBSAN},1)
CFLAGS+=-fsanitize=undefined
endif
.PHONY: all clean NSL_SIMULATOR
all: bin $(TARG)
bin:
mkdir -p bin
%.o: %.c %.h
$(CC) $(CFLAGS) -c -o $@ $< $(LDFLAGS)
bin/%: %.c $(OBJ)
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
NSL_SIMULATOR:
$(MAKE) -C $@/SOURCE/
tags:
etags --declarations *.c *.h NSL_SIMULATOR/SOURCE/*.h NSL_SIMULATOR/SOURCE/*.cpp `(find ${GUIX_ENVIRONMENT}/include -name '*.h')`
ctags *.c *.h NSL_SIMULATOR/SOURCE/*.h NSL_SIMULATOR/SOURCE/*.cpp `(find ${GUIX_ENVIRONMENT}/include -name '*.h')`
clean:
rm -f *.o $(TARG) seed.out
|