-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
31 lines (23 loc) · 725 Bytes
/
Copy pathMakefile
File metadata and controls
31 lines (23 loc) · 725 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
# This Makefile only use for Windows
SRC_DIR = ./src
BUILD_DIR = ./build
TARGET = $(BUILD_DIR)/NoHardCursor.exe
SRCS = $(wildcard $(SRC_DIR)/*.c)
OBJS = $(patsubst $(SRC_DIR)/%.c,$(BUILD_DIR)/%.o,$(SRCS))
DEPS = $(patsubst $(SRC_DIR)/%.c,$(BUILD_DIR)/%.d,$(SRCS))
LDFLAGS = -Wl,--gc-sections
CFLAGS = -Wall -Os -ffunction-sections -fdata-sections
$(TARGET): $(OBJS)
$(CC) $(LDFLAGS) $^ -o $@
strip $@
$(BUILD_DIR)/%.d: $(SRC_DIR)/%.c
rm -f %@; \
$(CC) -MM $< > $@.tmp; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.tmp > $@; \
rm -f $@.tmp
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c
$(CC) $(CFLAGS) -c $< -o $@
clean:
@echo "clean..."
$(shell pwsh -c "Get-ChildItem $(BUILD_DIR) -Recurse | Remove-Item")
-include $(DEPS)