forked from riolet/WAFer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
58 lines (43 loc) · 945 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
#!/bin/make
ifdef THREADS
PTHREAD=-D WAFER_THREADS=$(THREADS) -pthread
endif
ifdef DEBUG
ifeq ($(DEBUG),0)
DEBUG_OPT=-ggdb
else
DEBUG_OPT=-D WAFER_DEBUG -ggdb
endif
endif
ifdef PROCESSES
PROCESSES_OPT=-D WAFER_PROCESSES=$(PROCESSES) -ggdb
endif
ifdef LOOP
ifeq ($(LOOP),epoll)
LOOP_OPT=-D WAFER_EPOLL
endif
endif
ifdef MAX_CON_CONS
MAX_CON_CONS_OPT=-D WAFER_MAX_CON_CONS=$(MAX_CON_CONS)
endif
ifndef CC
CC=gcc
endif
EXT_OPTIONS=$(PTHREAD) $(DEBUG_OPT) $(PROCESSES_OPT) $(LOOP_OPT) $(MAX_CON_CONS_OPT)
AR=ar
CFLAGS=-W -Wall -O2 -Wno-unused-parameter -g $(EXT_OPTIONS)
LIBWAFER_OBJ=wafer.o waferapi.o
LIBWAFER=libwafer.a
MODULES=$(SERVER) example
all: $(MODULES)
# rule to build modules
%: %.c $(LIBWAFER)
$(CC) $(CFLAGS) -o $@ $^ $(OPTIONS)
$(LIBWAFER): $(LIBWAFER_OBJ)
$(AR) r $@ $^
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
clean:
rm -f $(LIBWAFER_OBJ)
distclean:
rm -f $(LIBWAFER) $(LIBWAFER_OBJ) $(MODULES)