Disable -Werror
[trinity.git] / Makefile
blob24c026904cf40943d342d03198983adc7afbbdbe
1 VERSION=1.3pre
3 INSTALL_PREFIX ?= $(DESTDIR)
4 INSTALL_PREFIX ?= $(HOME)
6 ifeq ($(CC),"")
7 CC := gcc
8 endif
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
13 ifneq ($(SYSROOT),)
14 CFLAGS += --sysroot=$(SYSROOT)
15 endif
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
18 CFLAGS += -Wformat=2
19 CFLAGS += -Winit-self
20 CFLAGS += -Wlogical-op
21 CFLAGS += -Wnested-externs
22 CFLAGS += -Wpacked
23 CFLAGS += -Wshadow
24 CFLAGS += -Wstrict-aliasing=3
25 CFLAGS += -Wswitch-default
26 CFLAGS += -Wswitch-enum
27 CFLAGS += -Wundef
28 CFLAGS += -Wwrite-strings
29 CFLAGS += -Wstrict-prototypes -Wmissing-prototypes
31 # Only enabled during development.
32 #CFLAGS += -Werror
34 V = @
35 Q = $(V:1=)
36 QUIET_CC = $(Q:@=@echo ' CC '$@;)
39 all: trinity
41 test:
42 @if [ ! -f config.h ]; then echo "\e[1;31mRun configure.sh first.\e[0m" ; exit; fi
45 MACHINE = $(shell $(CC) -dumpmachine)
46 SYSCALLS_ARCH = $(shell case "$(MACHINE)" in \
47 (sh*) echo syscalls/sh/*.c ;; \
48 (ia64*) echo syscalls/ia64/*.c ;; \
49 esac)
51 HEADERS = $(patsubst %.h,%.h,$(wildcard *.h)) $(patsubst %.h,%.h,$(wildcard syscalls/*.h)) $(patsubst %.h,%.h,$(wildcard ioctls/*.h))
53 SRCS = $(wildcard *.c) \
54 $(wildcard children/*.c) \
55 $(wildcard ioctls/*.c) \
56 $(wildcard net/*.c) \
57 $(wildcard syscalls/*.c) \
58 $(SYSCALLS_ARCH)
60 OBJS = $(sort $(patsubst %.c,%.o,$(wildcard *.c))) \
61 $(sort $(patsubst %.c,%.o,$(wildcard children/*.c))) \
62 $(sort $(patsubst %.c,%.o,$(wildcard ioctls/*.c))) \
63 $(sort $(patsubst %.c,%.o,$(wildcard net/*.c))) \
64 $(sort $(patsubst %.c,%.o,$(wildcard syscalls/*.c))) \
65 $(sort $(patsubst %.c,%.o,$(SYSCALLS_ARCH)))
67 DEPDIR= .deps
69 -include $(SRCS:%.c=$(DEPDIR)/%.d)
71 trinity: test $(OBJS) $(HEADERS)
72 $(QUIET_CC)$(CC) $(CFLAGS) -o trinity $(OBJS)
73 @mkdir -p tmp
75 df = $(DEPDIR)/$(*D)/$(*F)
77 %.o : %.c
78 $(QUIET_CC)$(CC) $(CFLAGS) -o $@ -c $<
79 @mkdir -p $(DEPDIR)/$(*D)
80 @gcc -MM $(CFLAGS) $*.c > $(df).d
81 @mv -f $(df).d $(df).d.tmp
82 @sed -e 's|.*:|$*.o:|' <$(df).d.tmp > $(df).d
83 @sed -e 's/.*://' -e 's/\\$$//' < $(df).d.tmp | fmt -1 | \
84 sed -e 's/^ *//' -e 's/$$/:/' >> $(df).d
85 @rm -f $(df).d.tmp
87 clean:
88 @rm -f $(OBJS)
89 @rm -f core.*
90 @rm -f trinity
91 @rm -f tags
92 @rm -rf $(DEPDIR)/*
94 devel:
95 @perl -p -i -e 's/^#CFLAGS \+\= -Werror/CFLAGS += -Werror/' Makefile
96 @perl -p -i -e 's/DEVEL=0/DEVEL=1/' configure.sh
97 git commit Makefile -m "Enable -Werror"
99 release:
100 @perl -p -i -e 's/^CFLAGS \+\= -Werror/#CFLAGS += -Werror/' Makefile
101 @perl -p -i -e 's/DEVEL=1/DEVEL=0/' configure.sh
102 git commit Makefile -m "Disable -Werror"
104 tag:
105 git tag -a $(VERSION) -m "$(VERSION) release."
107 tarball:
108 git repack -a -d
109 git prune-packed
110 git archive --format=tar.gz --prefix=trinity-$(VERSION)/ HEAD > trinity-$(VERSION).tgz
112 install: trinity
113 install -d -m 755 $(INSTALL_PREFIX)/bin
114 install trinity $(INSTALL_PREFIX)/bin
116 tags: $(SRCS)
117 @ctags -R --exclude=tmp
119 mirror:
120 @git push --mirror git@github.com:kernelslacker/trinity.git
122 scan:
123 @scan-build --use-analyzer=/usr/bin/clang make
125 coverity:
126 rm -rf cov-int trinity-coverity.tgz
127 cov-build --dir cov-int make
128 tar czvf trinity-coverity.tgz cov-int