-
Notifications
You must be signed in to change notification settings - Fork 11
/
checkrules
55 lines (41 loc) · 1.9 KB
/
checkrules
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
# These are some standard rules common to all Makefiles that perform
# tests. If you change this file please read README.tests in the
# toplevel directory first.
include $(top_srcdir)/configvars
# The variable "type" will be appended to "lib" when searching for
# libraries. Thus, to test the library with fpu code and >=m68020,
# set type to m68020. If you change this you must run "make checkclean".
type=m68000
# These are additional CFLAGS passed to the compiler and the linker.
# For fpu/m68020 libs:
# cflags=-m68020-60
# If you change this you must run "make checkclean".
cflags=$(CFLAGS_$(type))
CRT0 = $(top_srcdir)/build/$(type)/crt0.o
libs = $(libs-$(@F)) $(top_srcdir)/build/$(type)/libc.a
LIBS = -lgcc $(LIBS-$(@F)) $(libs) -lgcc
TESTPRGS = $(addprefix test-, $(TESTS))
TESTCFILES = $(addsuffix .c,$(TESTPRGS) $(EXTRAPRGS))
TESTOBJS = $(TESTCFILES:.c=.o)
DEP_FILES = $(addprefix $(top_srcdir)/build/$(type)/$(subdir)/.deps/,$(patsubst %.c,%.P,$(TESTCFILES)))
TESTCFLAGS = $(cflags) $(CFLAGS) $(EXTRACFLAGS)
TESTLDFLAGS = $(cflags) -s -nostartfiles -nostdlib
TESTDEFS = -D_GNU_SOURCE -D_REENTRANT
INCLUDES = -nostdinc -I$(shell cat $(top_srcdir)/includepath) \
-I$(top_srcdir)/include -I$(srcdir) -I$(top_srcdir) -I$(top_srcdir)/time
COMPILE = $(CC) $(TESTCFLAGS) $(CFLAGS-$(<F)) $(DEFS) $(DEFS-$(<F)) $(TESTDEFS)\
$(INCLUDES)
check: check-local $(libs) $(TESTPRGS)
$(top_srcdir)/do_test $(TESTS)
checkclean:
rm -f $(top_srcdir)/build/$(type)/$(subdir)/*.o $(TESTPRGS)
rm -rf $(top_srcdir)/build/$(type)/$(subdir)/.deps
$(TESTPRGS) $(EXTRAPRGS): %: %.o $(libs) $(CRT0)
$(CC) $(LDFLAGS) $(TESTLDFLAGS) $(CRT0) $< -o $@ $(LIBS)
.SUFFIXES:
.SUFFIXES: .o .c
.c.o:
@echo '$(COMPILE) -c $< -o $@'; \
$(COMPILE) -Wp,-MD,$(top_srcdir)/build/$(type)/$(subdir)/.deps/$(@:.o=.P) -c $< -o $@
DEPS_MAGIC := $(shell mkdir -p $(top_srcdir)/build/$(type)/$(subdir)/.deps > /dev/null 2>&1 || :)
-include $(DEP_FILES) /dev/null