summaryrefslogtreecommitdiff
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
parentcb0849cd053c06be08bc56feaaea3f9d1b572a44 (diff)
downloadrockbox-464a26d8913ba43d8bc6f71c1fbb9d9971628457.zip
rockbox-464a26d8913ba43d8bc6f71c1fbb9d9971628457.tar.gz
rockbox-464a26d8913ba43d8bc6f71c1fbb9d9971628457.tar.bz2
rockbox-464a26d8913ba43d8bc6f71c1fbb9d9971628457.tar.xz
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
-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 0000000..94e7790
--- /dev/null
+++ b/firmware/test/makefile-rules
@@ -0,0 +1,118 @@
+#############################################################################
+## __________ __ ___.
+## Open \______ \ ____ ____ | | _\_ |__ _______ ___
+## Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+## Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+## Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+## \/ \/ \/ \/ \/
+## Copyright Alan Korr, 2002. All rights reserved.
+##
+## Permission to use, copy, modify, and distribute this software for any
+## purpose is hereby granted without fee, provided that this copyright and
+## permissions notice appear in all copies and derivatives, and that no
+## charge may be made for the software and its documentation except to cover
+## cost of distribution.
+##
+## This software is provided "as is" without express or implied warranty.
+#############################################################################
+
+#######################################################################
+## PLEASE CONSIDER THERE IS NOTHING TO CHANGE IN THE FOLLOWING LINES
+## SINCE THERE ARE COMMON FOR ALL LIBRARY
+##
+
+.SUFFIXES : .o .c .s
+
+%.o: %.c
+ @echo "Compiling" $<...
+ @$(CC) -o $(@) $(CFLAGS) $(INCLUDES) -c $<
+ @$(CC) -M $< $(CFLAGS) $(INCLUDES) > $(*F).d
+
+%.o: %.s
+ @echo "Assembling" $<...
+ @$(CC) -o $(@) $(CFLAGS) $(INCLUDES) -c $<
+ @$(CC) -M $< $(CFLAGS) $(INCLUDES) > $(*F).d
+
+.PHONY: splash all clean backup restore dist install
+
+all: splash $(LIBRARY) test
+
+splash:
+ @echo "<<< " $(PACKAGE) "-" $(VERSION) ">>>"
+
+####################################################
+# LIBRAY PART :
+
+$(LIBRARY): $(OBJECTS)
+ @echo "Creating library" $(LIBRARY)...
+ @$(AR) cru $(@) $(OBJECTS)
+ @$(RL) $(@)
+
+####################################################
+# TEST PART :
+
+test: test.tab.o test.lex.o $(LIBRARY)
+ @echo "Creating executable" $@...
+ @$(CC) -g -o $(@) $(INCLUDES) $(+) -lfl -lreadline
+
+test.tab.o: test.tab.c
+ @echo "Compiling" $<...
+ @$(CC) $(INCLUDES) -g -o $(@) -O3 -fomit-frame-pointer -c test.tab.c
+
+test.lex.o: test.lex.c
+ @echo "Compiling" $<...
+ @$(CC) $(INCLUDES) -g -o $(@) -O3 -fomit-frame-pointer -c test.lex.c
+
+test.tab.h: test.tab.c
+
+test.lex.c: test.l test.tab.h
+ @echo "Flex:" $<
+ @flex -otest.lex.c test.l
+
+test.tab.c: test.y
+ @echo "Bison:" $<
+ @bison -d test.y
+
+
+####################################################
+# MISCELLANOUS PART :
+
+clean:
+ @rm -f $(LIBRARY)
+ @rm -f $(OBJECTS) test.lex.o test.tab.o
+ @rm -f $(DEPENDENCIES)
+ @rm -f *~ test test.exe
+ @rm -f test.tab.h test.tab.c test.lex.c
+ @rm -f core
+
+backup:
+ @mkdir -p ./backup
+ @cp -f makefile ./backup
+ @cp -f test.l ./backup
+ @cp -f test.y ./backup
+ @cp -f $(SOURCES:.c=.txt) ./backup
+ @for header in $(HEADERS) ; do cp -f $$header ./backup ; done
+ @for source in $(SOURCES) ; do cp -f $$source ./backup ; done
+
+restore:
+ @cp -f ./backup/makefile .
+ @cp -f ./backup/test.l .
+ @cp -f ./backup/test.y .
+ @cp -f ./backup/$(SOURCES:.c=.txt)
+ @for header in $(HEADERS) ; do cp -f ./backup/$$header . ; done
+ @for source in $(SOURCES) ; do cp -f ./backup/$$source . ; done
+
+dist: backup
+ @mv backup $(PACKAGE)
+ @tar czvf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)/*
+ @rm -f $(PACKAGE)/*
+ @rmdir $(PACKAGE)
+
+install: all
+ @mkdir -p $(PREFIX)/libraries
+ @cp $(LIBRARY) $(PREFIX)/libraries
+ @mkdir -p $(PREFIX)/headers/$(PACKAGE)
+ @for header in $(HEADERS) ; do cp $$header $(PREFIX)/headers/$(PACKAGE) ; done
+
+-include $(DEPENDENCIES)
+
diff --git a/firmware/test/makefile-vars b/firmware/test/makefile-vars
new file mode 100644
index 0000000..719f01d
--- /dev/null
+++ b/firmware/test/makefile-vars
@@ -0,0 +1,79 @@
+#############################################################################
+## __________ __ ___.
+## Open \______ \ ____ ____ | | _\_ |__ _______ ___
+## Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+## Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+## Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+## \/ \/ \/ \/ \/
+## Copyright Alan Korr, 2002. All rights reserved.
+##
+## Permission to use, copy, modify, and distribute this software for any
+## purpose is hereby granted without fee, provided that this copyright and
+## permissions notice appear in all copies and derivatives, and that no
+## charge may be made for the software and its documentation except to cover
+## cost of distribution.
+##
+## This software is provided "as is" without express or implied warranty.
+#############################################################################
+
+#######################################################################
+## PLEASE CONSIDER THERE IS NOTHING TO CHANGE IN THE FOLLOWING LINES
+## SINCE THERE ARE COMMON FOR ALL LIBRARY
+##
+
+ARCH=test
+
+CC = gcc
+AS = as
+LD = ld
+AR = ar
+RL = ranlib
+OC = objcopy
+GZ = gzip -f
+
+PREFIX = ~/rockbox/$(ARCH)
+DEFINES = -DTEST
+
+CFLAGS = -g
+#CFLAGS += -save-temps
+CFLAGS += -Wall \
+ -W \
+ -Wshadow \
+ -Wpointer-arith \
+ -Waggregate-return \
+ -Wstrict-prototypes \
+ -Wredundant-decls \
+ -Winline \
+ -Wmissing-prototypes \
+ -Werror \
+ -Wsign-compare \
+ -Wmissing-declarations \
+ -Wmissing-noreturns \
+ -Wnested-externs
+CFLAGS += -pipe -O3
+CFLAGS += -fomit-frame-pointer \
+ -fschedule-insns
+CFLAGS += $(EXTRA_CFLAGS)
+CFLAGS += $(DEFINES)
+
+INCLUDES = -I.. \
+ -I. \
+ -I$(PREFIX)/headers
+
+LIBRARY = lib$(PACKAGE).a
+
+HEADERS = $(PACKAGE).h \
+ config.h \
+ defines.h \
+ types.h \
+ return_values.h \
+ inlines.h \
+ functions.h
+
+SOURCES = $(wildcard $(PACKAGE)-*.c)
+
+OBJECTS = $(SOURCES:.c=.o)
+
+DEPENDENCIES = $(SOURCES:.c=.d)
+
+HEADER_PATH = $(PREFIX)/headers/$(PACKAGE)/.