blob: 170f31632e9eea114d6d01b4a70a0347e771b457 (
plain)
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
.SUFFIXES:
MAKEFLAGS += -r
ARCH ?= $(shell uname -m | sed \
-e s/i.86/x86/ \
-e s/x86_64/x86/ \
-e s/sun4u/sparc64/ \
-e s/arm.*/arm/ \
-e s/sa110/arm/ \
-e s/s390x/s390/ \
-e s/parisc64/parisc/ \
-e s/ppc64.*/ppc64/ \
-e s/mips.*/mips/ \
-e s/sh[234].*/sh/ \
-e s/aarch64.*/arm64/)
ifeq ($(ARCH),arm64)
ARCH ?= aarch64
SRCARCH ?= aarch64
endif
SRCARCH ?= $(ARCH)
ifeq ($(ARCH),arm)
ARMV := $(shell echo $(UNAME-M) | sed -nr 's/armv([[:digit:]]).*/\1/p; t; i7')
ifeq ($(ARMV),6)
USERCFLAGS += -march=armv6
else ifeq ($(ARMV),7)
USERCFLAGS += -march=armv7-a
endif
endif
CC := gcc
CFLAGS += -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
CFLAGS += $(USERCFLAGS)
CFLAGS += -D_GNU_SOURCE
CPPFLAGS += -iquote $(LIBDIR)/arch/$(SRCARCH)/include
ifeq ($(strip $(V)),)
E = @echo
Q = @
else
E = @\#
Q =
endif
RM := rm -f --one-file-system
ifeq ($(COMPAT_TEST),y)
ifeq ($(ARCH),x86)
export CFLAGS += -m32
export LDFLAGS += -m32
endif
endif
%.d: %.c
$(E) " DEP " $@
$(Q)$(CC) $(CFLAGS) $(CPPFLAGS) -MM -MP -c $< -o $@
%.o: %.c | %.d
$(E) " CC " $@
$(Q)$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
%: %.o $(LDLIBS)
@echo $@ >> .gitignore
$(E) " LINK " $@
$(Q)$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@
default: all
@true
.PHONY: default
gitignore-clean:
$(RM) .gitignore
.PHONY: gitignore-clean
clean: gitignore-clean
$(RM) $(OBJ) $(TST) *~
.PHONY: clean
cleandep: clean
$(RM) $(DEP)
.PHONY: cleandep
cleanout:
$(RM) -r *.pid *.out* *.test* *.state
.PHONY: cleanout
%.cleanout: %
$(Q) $(RM) -r $<.pid* $<.out* *$<.test* $<.*.test $<.*.state $<.state chew_$<.test*
realclean: cleandep cleanout
.PHONY: realclean
dep: $(DEP)
.PHONY: dep
no-deps-targets := clean cleandep cleanout realclean groups.cleanout
ifeq ($(strip $(DEP)),)
$(error No DEP defined in sub-make)
endif
ifeq ($(filter $(no-deps-targets), $(MAKECMDGOALS)),)
-include $(wildcard $(DEP))
endif
.SECONDARY:
|