This repository was archived by the owner on Jun 3, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
62 lines (52 loc) · 1.65 KB
/
Makefile
File metadata and controls
62 lines (52 loc) · 1.65 KB
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
.PHONY: all clean distclean
TZE = tze
VER_FILE := tze_version.h
HEADERS = $(wildcard *.h)
OBJECTS = $(patsubst %.c,%.o,$(sort $(wildcard *.c)))
VERSION := $(shell git describe --tag 2> /dev/null | sed -e 's/-g/-/')
SVERSION := $(shell sed -e 's/.*"\(.*\)".*/\1/p;d' $(VER_FILE) 2> /dev/null)
CPPFLAGS ?=
LDFLAGS ?=
CFLAGS ?= -g3 -pipe
CPPFLAGS += -D_LARGEFILE_SOURCE \
-D_LARGEFILE64_SOURCE \
-D_FILE_OFFSET_BITS=64 \
-D_POSIX_C_SOURCE=200809L \
-D_BSD_SOURCE=1 \
-D_XOPEN_SOURCE=600 \
-D_DEFAULT_SOURCE
CFLAGS += -std=c99 \
-ffunction-sections \
-fdata-sections \
-fstack-protector-all \
-ftabstop=4 \
-Waddress \
-Wall \
-Wconversion \
-Wempty-body \
-Winit-self \
-Wmissing-field-initializers \
-Wpointer-arith \
-Wredundant-decls \
-Wshadow \
-Wstack-protector \
-Wswitch-enum \
-Wtype-limits \
-Wundef \
-Wvla
LDFLAGS +=
all: $(TZE)
.PHONY: $(if $(filter $(VERSION),$(SVERSION)),,$(VER_FILE))
$(VER_FILE):
@echo "#ifndef TZE_VERSION_H" > $@
@echo "#define TZE_VERSION_H" >> $@
@echo "" >> $@
@echo "#define TZE_VERSION \""$(VERSION)"\"" >> $@
@echo "" >> $@
@echo "#endif /* TZE_VERSION_H */" >> $@
tze.o: $(VER_FILE)
$(TZE): $(OBJECTS) $(HEADERS) Makefile
$(CC) $(OBJECTS) $(LDFLAGS) -o $@
clean:
rm -f *.o $(TZE) $(VER_FILE)
distclean: clean