]> git.wh0rd.org - patches.git/blame - posixtestsuite-flags.patch
initial import
[patches.git] / posixtestsuite-flags.patch
CommitLineData
5e993f12 1--- Makefile
2+++ Makefile
3@@ -29,7 +29,9 @@
4
5 LOGFILE = $(top_builddir)/logfile
6
7-LDFLAGS := $(shell cat LDFLAGS | grep -v \^\#)
8+LDFLAGS := $(strip $(shell grep -sv '^\#' LDFLAGS))
9+CFLAGS := $(strip $(shell grep -sv '^\#' CFLAGS))
10+CPPFLAGS := $(strip $(shell grep -sv '^\#' CPPFLAGS))
11
12 RUN_TESTS := $(shell $(top_builddir)/locate-test \
13 --execs $(top_builddir)/$(POSIX_TARGET))
14@@ -54,14 +56,19 @@ stress-tests: stress-make stress-run
15 tests-pretty:
16 $(MAKE) all | column -t -s:
17
18-CFLAGS = -g -O2 -Wall -Werror -D_POSIX_C_SOURCE=200112L
19+ifeq ($(CFLAGS),)
20+CFLAGS = -g -O2
21+endif
22+CFLAGS += -Wall -Werror
23+ifeq ($(CPPFLAGS),)
24+CPPFLAGS = -D_POSIX_C_SOURCE=200112L
25+endif
26
27 # add -std=c99, -std=gnu99 if compiler supports it (gcc-2.95.3 does not).
28 check_gcc = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi)
29-CFLAGS += $(call check_gcc,-std=c99,)
30-CFLAGS += $(call check_gcc,-std=gnu99,)
31+CFLAGS += $(call check_gcc,-std=gnu99,$(call check_gcc,-std=c99,))
32
33-INCLUDE = -Iinclude
34+CPPFLAGS += -Iinclude
35
36 # FIXME: exaust cmd line length
37 clean:
38@@ -165,7 +172,7 @@ $(top_builddir)/t0.val: $(top_builddir)/
39 .PRECIOUS: %.o
40 %.o: %.c
41 @COMPLOG=$(LOGFILE).$$$$; \
42- if $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@ $(LDFLAGS) > $$COMPLOG 2>&1; \
43+ if $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ > $$COMPLOG 2>&1; \
44 then \
45 echo "$(@:.o=): build: PASS" | tee -a $(LOGFILE); \
46 else \
47--- LDFLAGS
48+++ LDFLAGS
49@@ -1,16 +1,11 @@
50 #This file contains all lines needed for linking the test suites.
51 #These may be on one line or multiple lines.
52 #
53-#Place the -l, -L, or -D piece before the item to link.
54+#Place the -l or -L pieces before the item to link.
55 #Lines beginning with # are comments.
56 #
57 #For example,
58-#-lpthread -D_GNU_SOURCE
59+#-lpthread
60 #
61 #Recommended flags:
62 #-D_XOPEN_SOURCE=600 -lpthread -lrt -lm
63-#
64-# For use with Linux, you may try the following flags to
65-# allow for the NPTL-specific compilation (used in some test cases)
66-# Note: this sometimes require the package nptl-devel.*.rpm to be installed.
67-#-I /usr/include/nptl -L /usr/lib/nptl -D_XOPEN_SOURCE=600 -lpthread -lrt -lm
68--- CPPFLAGS
69+++ CPPFLAGS
70@@ -0,0 +1,11 @@
71+#This file contains all the preprocessor flags (such as defines and includes)
72+#needed for compiling the test suites.
73+#These may be on one line or multiple lines.
74+#
75+#Lines beginning with # are comments.
76+#
77+#For example:
78+#-D_GNU_SOURCE -I/usr/include/nptl
79+#
80+#Recommended flags:
81+#-D_XOPEN_SOURCE=600
82--- CFLAGS
83+++ CFLAGS
84@@ -0,0 +1,11 @@
85+#This file contains all the optimizations/compiler settings
86+#needed for compiling the test suites.
87+#These may be on one line or multiple lines.
88+#
89+#Lines beginning with # are comments.
90+#
91+#For example:
92+#-g -O2 -std=c99
93+#
94+#Recommended flags:
95+#<defaults are ok>