0001-Move-to-RIOT-Makefiles.patch
4.86 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
From 07ab6c2cb9e4b03b3e413a733850f3f8199149d1 Mon Sep 17 00:00:00 2001
From: Martine Lenders <mail@martine-lenders.eu>
Date: Thu, 12 May 2016 14:55:13 +0200
Subject: [PATCH 1/3] Move to RIOT Makefiles
---
Makefile | 8 ++++++
libfixmath/Makefile | 51 +++----------------------------------
unittests/Makefile | 73 ++---------------------------------------------------
3 files changed, 13 insertions(+), 119 deletions(-)
create mode 100644 Makefile
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..b65e4b5
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,8 @@
+ifneq (,$(filter libfixmath,$(USEMODULE)))
+ DIRS += libfixmath
+endif
+ifneq (,$(filter libfixmath-unittests,$(USEMODULE)))
+ DIRS += unittests
+endif
+
+include $(RIOTBASE)/Makefile.base
diff --git a/libfixmath/Makefile b/libfixmath/Makefile
index b284590..c875b98 100644
--- a/libfixmath/Makefile
+++ b/libfixmath/Makefile
@@ -1,48 +1,3 @@
-#Project settings
-PROJECT = libfixmath
-LIB =
-SRC = .
-INC =
-
-#Compiler settings
-CPP = gcc
-CC = gcc
-AS = gcc
-LD = gcc
-AR = ar
-CPP_FLAGS = -O2 $(INC) -Wall -Wextra -c
-CC_FLAGS = -O2 $(INC) -Wall -Wextra -c
-AS_FLAGS = $(CC_FLAGS) -D_ASSEMBLER_
-LD_FLAGS = -Wall
-
-# Find all source files
-SRC_CPP = $(foreach dir, $(SRC), $(wildcard $(dir)/*.cpp))
-SRC_C = $(foreach dir, $(SRC), $(wildcard $(dir)/*.c))
-SRC_S = $(foreach dir, $(SRC), $(wildcard $(dir)/*.S))
-OBJ_CPP = $(patsubst %.cpp, %.o, $(SRC_CPP))
-OBJ_C = $(patsubst %.c, %.o, $(SRC_C))
-OBJ_S = $(patsubst %.S, %.o, $(SRC_S))
-OBJ = $(OBJ_CPP) $(OBJ_C) $(OBJ_S)
-
-# Compile rules.
-.PHONY : all
-all: $(PROJECT).a
-
-$(PROJECT).a: $(OBJ)
- $(AR) rcs $(PROJECT).a $(OBJ)
-
-$(OBJ_CPP) : %.o : %.cpp
- $(CPP) $(CPP_FLAGS) -o $@ $<
-
-$(OBJ_C) : %.o : %.c
- $(CC) $(CC_FLAGS) -o $@ $<
-
-$(OBJ_S) : %.o : %.S
- $(AS) $(AS_FLAGS) -o $@ $<
-
-
-
-# Clean rules
-.PHONY : clean
-clean:
- rm -f $(PROJECT).a $(OBJ)
+MODULE = libfixmath
+
+include $(RIOTBASE)/Makefile.base
diff --git a/unittests/Makefile b/unittests/Makefile
index 329caf4..245ffb9 100644
--- a/unittests/Makefile
+++ b/unittests/Makefile
@@ -1,72 +1,3 @@
-# Makefile for running the unittests of libfixmath.
-CC = gcc
-
-# Basic CFLAGS for debugging
-CFLAGS = -g -O0 -I../libfixmath -Wall -Wextra -Werror
-
-# The files required for tests
-FIX16_SRC = ../libfixmath/fix16.c ../libfixmath/fix16_sqrt.c ../libfixmath/fix16_str.c \
- ../libfixmath/fix16_exp.c ../libfixmath/fix16.h
-
-all: run_fix16_unittests run_fix16_exp_unittests run_fix16_str_unittests run_fix16_macros_unittests
-
-clean:
- rm -f fix16_unittests_????
-
-# The library is tested automatically under different compilations
-# options.
-#
-# Test naming:
-# r = rounding, n = no rounding
-# o = overflow detection, n = no overflow detection
-# 64 = int64_t math, 32 = int32_t math
-
-run_fix16_unittests: \
- fix16_unittests_ro64 fix16_unittests_no64 \
- fix16_unittests_rn64 fix16_unittests_nn64 \
- fix16_unittests_ro32 fix16_unittests_no32 \
- fix16_unittests_rn32 fix16_unittests_nn32 \
- fix16_unittests_ro08 fix16_unittests_no08 \
- fix16_unittests_rn08 fix16_unittests_nn08
- $(foreach test, $^, \
- echo $(test) && \
- ./$(test) > /dev/null && \
- ) true
-
-fix16_unittests_no64: DEFINES=-DFIXMATH_NO_ROUNDING
-fix16_unittests_rn64: DEFINES=-DFIXMATH_NO_OVERFLOW
-fix16_unittests_nn64: DEFINES=-DFIXMATH_NO_ROUNDING -DFIXMATH_NO_OVERFLOW
-fix16_unittests_ro32: DEFINES=-DFIXMATH_NO_64BIT
-fix16_unittests_no32: DEFINES=-DFIXMATH_NO_ROUNDING -DFIXMATH_NO_64BIT
-fix16_unittests_rn32: DEFINES=-DFIXMATH_NO_OVERFLOW -DFIXMATH_NO_64BIT
-fix16_unittests_nn32: DEFINES=-DFIXMATH_NO_OVERFLOW -DFIXMATH_NO_ROUNDING -DFIXMATH_NO_64BIT
-fix16_unittests_ro08: DEFINES=-DFIXMATH_OPTIMIZE_8BIT
-fix16_unittests_no08: DEFINES=-DFIXMATH_NO_ROUNDING -DFIXMATH_OPTIMIZE_8BIT
-fix16_unittests_rn08: DEFINES=-DFIXMATH_NO_OVERFLOW -DFIXMATH_OPTIMIZE_8BIT
-fix16_unittests_nn08: DEFINES=-DFIXMATH_NO_OVERFLOW -DFIXMATH_NO_ROUNDING -DFIXMATH_OPTIMIZE_8BIT
-
-fix16_unittests_% : fix16_unittests.c $(FIX16_SRC)
- $(CC) $(CFLAGS) $(DEFINES) -o $@ $^ -lm
-
-
-# Tests for the exponential function, run only in default config
-run_fix16_exp_unittests: fix16_exp_unittests
- ./fix16_exp_unittests > /dev/null
-
-fix16_exp_unittests: fix16_exp_unittests.c $(FIX16_SRC)
- $(CC) $(CFLAGS) $(DEFINES) -o $@ $^ -lm
-
-# Tests for string conversion, run only in default config
-run_fix16_str_unittests: fix16_str_unittests
- ./fix16_str_unittests > /dev/null
-
-fix16_str_unittests: fix16_str_unittests.c $(FIX16_SRC)
- $(CC) $(CFLAGS) $(DEFINES) -o $@ $^ -lm
-
-# Tests for literal macros, run only in default config
-run_fix16_macros_unittests: fix16_macros_unittests
- ./fix16_macros_unittests > /dev/null
-
-fix16_macros_unittests: fix16_macros_unittests.c $(FIX16_SRC)
- $(CC) $(CFLAGS) $(DEFINES) -o $@ $^ -lm
+MODULE = libfixmath-unittests
+include $(RIOTBASE)/Makefile.base
--
2.7.4