-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathMakefile
63 lines (46 loc) · 1023 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
58
59
60
61
62
#!/bin/make
ifdef THREADS
NTHREAD=-D NOPE_THREADS=$(THREADS)
endif
ifdef DEBUG
ifeq ($(DEBUG),0)
DEBUG_OPT=-ggdb
else
DEBUG_OPT=-D NOPE_DEBUG -ggdb
endif
endif
ifdef PROCESSES
PROCESSES_OPT=-D NOPE_PROCESSES=$(PROCESSES) -ggdb
endif
ifdef LOOP
ifeq ($(LOOP),epoll)
LOOP_OPT=-D NOPE_EPOLL
endif
endif
ifdef MAX_CON_CONS
MAX_CON_CONS_OPT=-D NOPE_MAX_CON_CONS=$(MAX_CON_CONS)
endif
ifndef CC
CC=gcc
endif
EXT_OPTIONS=$(NTHREAD) $(DEBUG_OPT) $(PROCESSES_OPT) $(LOOP_OPT) $(MAX_CON_CONS_OPT) -pthread
AR=ar
CFLAGS=-W -Wall -O2 -Wno-unused-parameter -g $(EXT_OPTIONS)
LIBLONG_OBJ=wafer.o waferapi.o sqlite3.o
LIBLONG=liblong.a
MODULES=longs
OPTIONS=-ldl
all: $(MODULES)
# rule to build modules
%: %.c $(LIBLONG)
$(CC) $(CFLAGS) -o $@ $^ $(OPTIONS)
$(LIBLONG): $(LIBLONG_OBJ)
$(AR) r $@ $^
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
test:
$(CC) $(CFLAGS) -o longs_test longs_test.c $(LIBLONG) $(OPTIONS)
clean:
rm -f $(LIBLONG_OBJ) $(MODULES)
distclean:
rm -f $(LIBLONG) $(LIBNOPE_OBJ) $(MODULES)