summaryrefslogtreecommitdiff
path: root/firmware/test
diff options
context:
space:
mode:
authorAlan Korr <alkorr@rockbox.org>2002-04-16 18:21:06 +0000
committerAlan Korr <alkorr@rockbox.org>2002-04-16 18:21:06 +0000
commit464a26d8913ba43d8bc6f71c1fbb9d9971628457 (patch)
tree6c2dfce5db9ebd55a779dc420ee8eda10d8fc715 /firmware/test
parentcb0849cd053c06be08bc56feaaea3f9d1b572a44 (diff)
downloadrockbox-464a26d8913ba43d8bc6f71c1fbb9d9971628457.tar.gz
rockbox-464a26d8913ba43d8bc6f71c1fbb9d9971628457.zip
Ok, I move all what is common in 'test' directory
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@105 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/test')
-rw-r--r--firmware/test/makefile-rules118
-rw-r--r--firmware/test/makefile-vars79
2 files changed, 197 insertions, 0 deletions
diff --git a/firmware/test/makefile-rules b/firmware/test/makefile-rules
new file mode 100644
index 0000000000..94e779082c
--- /dev/null
+++ b/firmware/test/makefile-rules
@@ -0,0 +1,118 @@
1#############################################################################
2## __________ __ ___.
3## Open \______ \ ____ ____ | | _\_ |__ _______ ___
4## Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5## Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6## Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7## \/ \/ \/ \/ \/
8## Copyright Alan Korr, 2002. All rights reserved.
9##
10## Permission to use, copy, modify, and distribute this software for any
11## purpose is hereby granted without fee, provided that this copyright and
12## permissions notice appear in all copies and derivatives, and that no
13## charge may be made for the software and its documentation except to cover
14## cost of distribution.
15##
16## This software is provided "as is" without express or implied warranty.
17#############################################################################
18
19#######################################################################
20## PLEASE CONSIDER THERE IS NOTHING TO CHANGE IN THE FOLLOWING LINES
21## SINCE THERE ARE COMMON FOR ALL LIBRARY
22##
23
24.SUFFIXES : .o .c .s
25
26%.o: %.c
27 @echo "Compiling" $<...
28 @$(CC) -o $(@) $(CFLAGS) $(INCLUDES) -c $<
29 @$(CC) -M $< $(CFLAGS) $(INCLUDES) > $(*F).d
30
31%.o: %.s
32 @echo "Assembling" $<...
33 @$(CC) -o $(@) $(CFLAGS) $(INCLUDES) -c $<
34 @$(CC) -M $< $(CFLAGS) $(INCLUDES) > $(*F).d
35
36.PHONY: splash all clean backup restore dist install
37
38all: splash $(LIBRARY) test
39
40splash:
41 @echo "<<< " $(PACKAGE) "-" $(VERSION) ">>>"
42
43####################################################
44# LIBRAY PART :
45
46$(LIBRARY): $(OBJECTS)
47 @echo "Creating library" $(LIBRARY)...
48 @$(AR) cru $(@) $(OBJECTS)
49 @$(RL) $(@)
50
51####################################################
52# TEST PART :
53
54test: test.tab.o test.lex.o $(LIBRARY)
55 @echo "Creating executable" $@...
56 @$(CC) -g -o $(@) $(INCLUDES) $(+) -lfl -lreadline
57
58test.tab.o: test.tab.c
59 @echo "Compiling" $<...
60 @$(CC) $(INCLUDES) -g -o $(@) -O3 -fomit-frame-pointer -c test.tab.c
61
62test.lex.o: test.lex.c
63 @echo "Compiling" $<...
64 @$(CC) $(INCLUDES) -g -o $(@) -O3 -fomit-frame-pointer -c test.lex.c
65
66test.tab.h: test.tab.c
67
68test.lex.c: test.l test.tab.h
69 @echo "Flex:" $<
70 @flex -otest.lex.c test.l
71
72test.tab.c: test.y
73 @echo "Bison:" $<
74 @bison -d test.y
75
76
77####################################################
78# MISCELLANOUS PART :
79
80clean:
81 @rm -f $(LIBRARY)
82 @rm -f $(OBJECTS) test.lex.o test.tab.o
83 @rm -f $(DEPENDENCIES)
84 @rm -f *~ test test.exe
85 @rm -f test.tab.h test.tab.c test.lex.c
86 @rm -f core
87
88backup:
89 @mkdir -p ./backup
90 @cp -f makefile ./backup
91 @cp -f test.l ./backup
92 @cp -f test.y ./backup
93 @cp -f $(SOURCES:.c=.txt) ./backup
94 @for header in $(HEADERS) ; do cp -f $$header ./backup ; done
95 @for source in $(SOURCES) ; do cp -f $$source ./backup ; done
96
97restore:
98 @cp -f ./backup/makefile .
99 @cp -f ./backup/test.l .
100 @cp -f ./backup/test.y .
101 @cp -f ./backup/$(SOURCES:.c=.txt)
102 @for header in $(HEADERS) ; do cp -f ./backup/$$header . ; done
103 @for source in $(SOURCES) ; do cp -f ./backup/$$source . ; done
104
105dist: backup
106 @mv backup $(PACKAGE)
107 @tar czvf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)/*
108 @rm -f $(PACKAGE)/*
109 @rmdir $(PACKAGE)
110
111install: all
112 @mkdir -p $(PREFIX)/libraries
113 @cp $(LIBRARY) $(PREFIX)/libraries
114 @mkdir -p $(PREFIX)/headers/$(PACKAGE)
115 @for header in $(HEADERS) ; do cp $$header $(PREFIX)/headers/$(PACKAGE) ; done
116
117-include $(DEPENDENCIES)
118
diff --git a/firmware/test/makefile-vars b/firmware/test/makefile-vars
new file mode 100644
index 0000000000..719f01dd98
--- /dev/null
+++ b/firmware/test/makefile-vars
@@ -0,0 +1,79 @@
1#############################################################################
2## __________ __ ___.
3## Open \______ \ ____ ____ | | _\_ |__ _______ ___
4## Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5## Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6## Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7## \/ \/ \/ \/ \/
8## Copyright Alan Korr, 2002. All rights reserved.
9##
10## Permission to use, copy, modify, and distribute this software for any
11## purpose is hereby granted without fee, provided that this copyright and
12## permissions notice appear in all copies and derivatives, and that no
13## charge may be made for the software and its documentation except to cover
14## cost of distribution.
15##
16## This software is provided "as is" without express or implied warranty.
17#############################################################################
18
19#######################################################################
20## PLEASE CONSIDER THERE IS NOTHING TO CHANGE IN THE FOLLOWING LINES
21## SINCE THERE ARE COMMON FOR ALL LIBRARY
22##
23
24ARCH=test
25
26CC = gcc
27AS = as
28LD = ld
29AR = ar
30RL = ranlib
31OC = objcopy
32GZ = gzip -f
33
34PREFIX = ~/rockbox/$(ARCH)
35DEFINES = -DTEST
36
37CFLAGS = -g
38#CFLAGS += -save-temps
39CFLAGS += -Wall \
40 -W \
41 -Wshadow \
42 -Wpointer-arith \
43 -Waggregate-return \
44 -Wstrict-prototypes \
45 -Wredundant-decls \
46 -Winline \
47 -Wmissing-prototypes \
48 -Werror \
49 -Wsign-compare \
50 -Wmissing-declarations \
51 -Wmissing-noreturns \
52 -Wnested-externs
53CFLAGS += -pipe -O3
54CFLAGS += -fomit-frame-pointer \
55 -fschedule-insns
56CFLAGS += $(EXTRA_CFLAGS)
57CFLAGS += $(DEFINES)
58
59INCLUDES = -I.. \
60 -I. \
61 -I$(PREFIX)/headers
62
63LIBRARY = lib$(PACKAGE).a
64
65HEADERS = $(PACKAGE).h \
66 config.h \
67 defines.h \
68 types.h \
69 return_values.h \
70 inlines.h \
71 functions.h
72
73SOURCES = $(wildcard $(PACKAGE)-*.c)
74
75OBJECTS = $(SOURCES:.c=.o)
76
77DEPENDENCIES = $(SOURCES:.c=.d)
78
79HEADER_PATH = $(PREFIX)/headers/$(PACKAGE)/.