forked from fritz0705/dhcpd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (35 loc) · 994 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
.PHONY: all install clean
.SUFFIXES: .d
CC := gcc
LD := $(CC)
CXX := g++
GREP ?= grep
PKGCONFIG ?= pkg-config
ifdef DEBUG
LDFLAGS += -g -O0
CFLAGS += -g -O0
CXXFLAGS += -g -O0
else
LDFLAGS += -O3 -flto
CFLAGS += -O3 -flto
CXXFLAGS += -O3 -flto
endif
LDFLAGS += -lev
CFLAGS += -Wall -Wextra -Werror -std=c11 -pedantic -fno-strict-aliasing
CXXFLAGS += -Wall -Wextra -Werror -std=c++11 -pedantic -fno-strict-aliasing
SRCS := $(wildcard *.c)
SRCS_MAIN := $(shell $(GREP) -l 'int main' $(SRCS))
SRCS_UTIL := $(filter-out $(SRCS_MAIN), $(SRCS))
OBJS := $(patsubst %.c,%.o,$(SRCS))
OBJS_MAIN := $(patsubst %.c,%.o,$(SRCS_MAIN))
OBJS_UTIL := $(patsubst %.c,%.o,$(SRCS_UTIL))
BIN := $(patsubst %.c,%,$(shell $(GREP) -l 'int main' $(SRCS_MAIN)))
LIBS += libcap-ng
LDFLAGS += $(shell pkg-config --libs $(LIBS))
CFLAGS += $(shell pkg-config --cflags $(LIBS))
all: $(BIN)
clean:
$(RM) dhcpd dhcpstress *.d *.o
$(BIN): $(OBJS)
$(LD) -o $@ [email protected] $(OBJS_UTIL) $(LDFLAGS) $(FLAGS_L)
-include %.d