-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
47 lines (35 loc) · 875 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
#
# Makefile for problem set 2, introduction to synchronizaiton.
#
# Author: Nikos Nikoleris <[email protected]>
#
# Change to y to enable debugging support
DEBUG:=
CFLAGS=-pthread -std=c99 -D_XOPEN_SOURCE=600 -Wall -Wextra
LDLIBS=-pthread -lrt
CC=gcc
ifeq ($(DEBUG), y)
CFLAGS += -g
LDFLAGS += -g
else
CFLAGS += -O2
LDFLAGS += -O2
endif
all: bounded_buffer rendezvous synchro
bounded_buffer: bounded_buffer.o
rendezvous: rendezvous.o
synchro: synchro.o timing.o
%.o: %.c
gcc -c $(CFLAGS) $*.c -o $*.o
@gcc -MM $(CFLAGS) $*.c > $*.d
@mv -f $*.d $*.d.tmp
@sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d
@sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \
sed -e 's/^ *//' -e 's/$$/:/' >> $*.d
@rm -f $*.d.tmp
-include $(CFILES:%.c=%.d)
clean:
$(RM) *.o *.d *~ $(EXEFILES)
distclean: clean
$(RM) synchro rendezvous bounded_buffer
.PHONY: all clean