3 INSTALL_PREFIX ?
= $(DESTDIR
)
4 INSTALL_PREFIX ?
= $(HOME
)
9 CC
:= $(CROSS_COMPILE
)$(CC
)
10 LD
:= $(CROSS_COMPILE
)$(LD
)
12 CFLAGS
+= -Wall
-W
-g
-O2
-I.
-Iinclude
/ -Wimplicit
-D_FORTIFY_SOURCE
=2 -D_GNU_SOURCE
-D__linux__
14 CFLAGS
+= --sysroot
=$(SYSROOT
)
16 #CFLAGS += $(shell if $(CC) -m32 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-m32"; fi)
17 CFLAGS
+= -Wdeclaration-after-statement
20 CFLAGS
+= -Wlogical-op
21 CFLAGS
+= -Wnested-externs
24 CFLAGS
+= -Wstrict-aliasing
=3
25 CFLAGS
+= -Wswitch-enum
27 CFLAGS
+= -Wwrite-strings
28 CFLAGS
+= -Wno-format-nonliteral
29 CFLAGS
+= -Wstrict-prototypes
-Wmissing-prototypes
31 # Only enabled during development, and on gcc 4.8+
32 CPP_MAJOR
:= $(shell $(CPP
) -dumpversion
2>&1 | cut
-d
'.' -f1
)
33 CPP_MINOR
:= $(shell $(CPP
) -dumpversion
2>&1 | cut
-d
'.' -f2
)
34 DEVEL
:= $(shell grep VERSION Makefile | head
-n1 | grep pre | wc
-l
)
35 CFLAGS
+= $(shell if
[ $(CPP_MAJOR
) -eq
4 -a
$(CPP_MINOR
) -ge
8 -a
$(DEVEL
) -eq
1 ] ; then echo
"-Werror"; else echo
""; fi
)
39 QUIET_CC
= $(Q
:@
=@echo
' CC '$@
;)
45 @if
[ ! -f config.h
]; then echo
"\e[1;31mRun configure.sh first.\e[0m" ; exit
; fi
48 MACHINE
= $(shell $(CC
) -dumpmachine
)
49 SYSCALLS_ARCH
= $(shell case
"$(MACHINE)" in \
50 (sh
*) echo syscalls
/sh
/*.c
;; \
51 (ia64
*) echo syscalls
/ia64
/*.c
;; \
54 HEADERS
= $(patsubst %.h
,%.h
,$(wildcard *.h
)) $(patsubst %.h
,%.h
,$(wildcard syscalls
/*.h
)) $(patsubst %.h
,%.h
,$(wildcard ioctls
/*.h
))
56 SRCS
= $(wildcard *.c
) \
57 $(wildcard children
/*.c
) \
58 $(wildcard ioctls
/*.c
) \
60 $(wildcard syscalls
/*.c
) \
63 OBJS
= $(sort $(patsubst %.c
,%.o
,$(wildcard *.c
))) \
64 $(sort $(patsubst %.c
,%.o
,$(wildcard children
/*.c
))) \
65 $(sort $(patsubst %.c
,%.o
,$(wildcard ioctls
/*.c
))) \
66 $(sort $(patsubst %.c
,%.o
,$(wildcard net
/*.c
))) \
67 $(sort $(patsubst %.c
,%.o
,$(wildcard syscalls
/*.c
))) \
68 $(sort $(patsubst %.c
,%.o
,$(SYSCALLS_ARCH
)))
72 -include $(SRCS
:%.c
=$(DEPDIR
)/%.d
)
74 trinity
: test $(OBJS
) $(HEADERS
)
75 $(QUIET_CC
)$(CC
) $(CFLAGS
) $(LDFLAGS
) -o trinity
$(OBJS
)
78 df
= $(DEPDIR
)/$(*D
)/$(*F
)
81 $(QUIET_CC
)$(CC
) $(CFLAGS
) $(LDFLAGS
) -o
$@
-c
$<
82 @mkdir
-p
$(DEPDIR
)/$(*D
)
83 @gcc
-MM
$(CFLAGS
) $*.c
> $(df
).d
84 @mv
-f
$(df
).d
$(df
).d.tmp
85 @sed
-e
's|.*:|$*.o:|' <$(df
).d.tmp
> $(df
).d
86 @sed
-e
's/.*://' -e
's/\\$$//' < $(df
).d.tmp | fmt
-1 | \
87 sed
-e
's/^ *//' -e
's/$$/:/' >> $(df
).d
98 @perl
-p
-i
-e
's/DEVEL=0/DEVEL=1/' configure.sh
99 git commit Makefile configure.sh
-m
"Enable -Werror & devel mode"
102 @perl
-p
-i
-e
's/DEVEL=1/DEVEL=0/' configure.sh
103 git commit Makefile configure.sh
-m
"Disable -Werror & devel mode"
106 git tag
-a
$(VERSION
) -m
"$(VERSION) release."
111 git archive
--format
=tar.gz
--prefix=trinity-
$(VERSION
)/ HEAD
> trinity-
$(VERSION
).tgz
114 install -d
-m
755 $(INSTALL_PREFIX
)/bin
115 install trinity
$(INSTALL_PREFIX
)/bin
118 @ctags
-R
--exclude
=tmp
121 @git push
--mirror git@github.com
:kernelslacker
/trinity.git
124 @scan-build
--use-analyzer
=/usr
/bin
/clang make
127 rm -rf cov-int trinity-coverity.tgz
128 cov-build
--dir cov-int make
129 tar czvf trinity-coverity.tgz cov-int