-
Notifications
You must be signed in to change notification settings - Fork 0
/
webxs.mk
51 lines (37 loc) · 1.15 KB
/
webxs.mk
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
CC := gcc
CCP := g++
LD := g++
RM := rm
# The output executable.
BIN := webxs
# Toolchain arguments.
CCFLAGS := -Os
//CCFLAGS := -g -ggdb
CCPLAGS := $(CCFLAGS)
ifeq ($(OS),Windows_NT)
LDFLAGS = -lpthread -lws2_32 -lcomdlg32 -static-libgcc
else
//LDFLAGS := -lpthread -ldl -lrt -g -ggdb
LDFLAGS := -lpthread -ldl -lrt -flto
endif
DEADCODESTRIP := -fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,-s
//DEADCODESTRIP :=
# Project sources.
C_SOURCE_FILES := webxs.c
//CPP_SOURCE_FILES := webxs_core.cpp
C_OBJECT_FILES := $(patsubst %.c,%.o,$(C_SOURCE_FILES))
CPP_OBJECT_FILES := $(patsubst %.cpp,%.o,$(CPP_SOURCE_FILES))
# The dependency file names.
DEPS := $(C_OBJECT_FILES:.o=.d), $(CPP_OBJECT_FILES:.o=.d)
all: $(BIN)
clean:
rm -f $(C_OBJECT_FILES) $(CPP_OBJECT_FILES) $(DEPS) $(BIN)
rebuild: clean all
$(BIN): $(C_OBJECT_FILES) $(CPP_OBJECT_FILES)
$(LD) $(C_OBJECT_FILES) $(CPP_OBJECT_FILES) $(DEADCODESTRIP) $(LDFLAGS) -o $@
%.o: %.c
$(CC) -c -MMD -MP $< -o $@ $(DEADCODESTRIP) $(CCFLAGS)
%.o: %.cpp
$(CCP) -c -MMD -MP $< -o $@ $(DEADCODESTRIP) $(CCPLAGS)
# Let make read the dependency files and handle them.
-include $(DEPS)