-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
43 lines (30 loc) · 728 Bytes
/
Makefile
File metadata and controls
43 lines (30 loc) · 728 Bytes
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
NAME = http-server
BUILD_DIR = build
OBJ_DIR = $(BUILD_DIR)/obj-$(NAME)
BINARY = $(BUILD_DIR)/$(NAME)
SRCS = $(shell find src -name "*.c")
OBJS = $(addprefix $(OBJ_DIR)/,$(SRCS:%.c=%.o))
LIBS = ssl crypto pthread
CFLAGS += -O2 -flto -Wall -Werror
LDFLAGS += $(CFLAGS) $(addprefix -l,$(LIBS))
CC = gcc
LD = gcc
SCRIPTS = $(shell find . -name "*.sh")
$(OBJ_DIR)/%.o: %.c
@echo + CC $<
@mkdir -p $(dir $@)
@$(CC) $< -c -o $@ -ggdb3 $(CFLAGS) -MMD
$(BINARY): $(OBJS)
@echo + LD $@
@mkdir -p $(dir $@)
@$(LD) $^ -o $@ $(LDFLAGS)
all: $(BINARY)
run: all
$(BINARY) 2>&1 | tee log
clean:
@rm build -rf
$(SCRIPTS:%.sh=%):
./$@.sh
.PHONY: clean all run $(SCRIPTS:%.sh=%)
.DEFAULT_GOAL := all
-include $(OBJS:.o=.d)