Browse Source

Now with nicer makefiles, auto OS detection

Thomas Buck 12 years ago
parent
commit
8f95871b93

+ 0
- 76
Cube Control/makefile View File

@@ -1,76 +0,0 @@
1
-JAVAC = javac
2
-JAVADOC = javadoc
3
-JAVAH = javah
4
-DOCDIR = doc
5
-CC = gcc
6
-TARGET = unix
7
-#TARGET= cygwin
8
-#TARGET = win
9
-
10
-HEADERPATH = /System/Library/Frameworks/JavaVM.framework/Headers
11
-
12
-# Java files to be compiled
13
-# Needs to be a complete list so they work as target
14
-JAVAFILES = HelperUtility.java AnimationUtility.java Animation.java AFrame.java cubeWorker.java layerEditFrame.java Led3D.java Frame.java
15
-
16
-ifeq ($(TARGET),unix)
17
-INJAR = *.class *.png
18
-RM = rm -f
19
-else
20
-INJAR = *.class *.png
21
-RM = del
22
-endif
23
-
24
-# Cygwin needs the .exe file, but the rm command!
25
-# Don't add a space after the comma. You get 'missing separator'...
26
-# Also add a space after 'ifeq', else you get 'missing separator'...
27
-ifeq ($(TARGET),cygwin)
28
-RM = rm
29
-endif
30
-
31
-# Spit out jar file, documentation, delete intermediate files
32
-all: build
33
-
34
-# Generate Documentation
35
-doc: doc/index.html
36
-
37
-# Compile java files
38
-java: Frame.class
39
-
40
-# Spit out jar file, dont remove anything after that
41
-build: Frame.class libSerial
42
-	jar -cmf manifest.txt "Cube Control.jar" $(INJAR)
43
-
44
-# Compile java files
45
-Frame.class: $(JAVAFILES)
46
-	$(JAVAC) $(JAVAFILES)
47
-
48
-doc/index.html: $(JAVAFILES)
49
-	$(JAVADOC) -d $(DOCDIR) $(JAVAFILES)
50
-
51
-# Compile serial Helper
52
-ifeq ($(TARGET),unix)
53
-libSerial: serialInterface.h serialHelper.c helper/unixSerial.c
54
-	$(CC) -x c -I$(HEADERPATH) -c serialHelper.c -o serialHelper.o
55
-	$(CC) -dynamiclib -o libSerial.jnilib serialHelper.o
56
-else
57
-libSerial: serialInterface.h serialHelper.c helper/winSerial.c
58
-	$(CC) -x c -I$(HEADERPATH) -c serialHelper.c -o serialHelper.o -D winHelper
59
-	$(CC) -dynamiclib -o libSerial.dll serialHelper.o
60
-endif
61
-
62
-serialInterface.h:
63
-	$(JAVAC) HelperUtility.java
64
-	$(JAVAH) -o serialInterface.h HelperUtility
65
-
66
-# Delete intermediate files
67
-clean:
68
-	$(RM) *.class
69
-	$(RM) *.h
70
-	$(RM) *.o
71
-	$(RM) *.jar
72
-ifeq ($(TARGET),unix)
73
-	$(RM) *.jnilib
74
-else
75
-	$(RM) *.dll
76
-endif

Cube Control/AFrame.java → CubeControl/AFrame.java View File


Cube Control/Animation.java → CubeControl/Animation.java View File


Cube Control/AnimationUtility.java → CubeControl/AnimationUtility.java View File


Cube Control/Frame.java → CubeControl/Frame.java View File


Cube Control/HelperUtility.java → CubeControl/HelperUtility.java View File


Cube Control/LEDoff.png → CubeControl/LEDoff.png View File


Cube Control/LEDon.png → CubeControl/LEDon.png View File


Cube Control/Led3D.java → CubeControl/Led3D.java View File


Cube Control/bg.png → CubeControl/bg.png View File


Cube Control/cubeWorker.java → CubeControl/cubeWorker.java View File


Cube Control/helper/unixSerial.c → CubeControl/helper/unixSerial.c View File


Cube Control/helper/winSerial.c → CubeControl/helper/winSerial.c View File


Cube Control/layerEditFrame.java → CubeControl/layerEditFrame.java View File


+ 59
- 0
CubeControl/makefile View File

@@ -0,0 +1,59 @@
1
+# Name of your C-Compiler
2
+CC = gcc
3
+# Path to jni.h
4
+HEADERPATH = /System/Library/Frameworks/JavaVM.framework/Headers
5
+
6
+# All java files to be compiled
7
+# List so it works as target
8
+JAVAFILES = HelperUtility.java AnimationUtility.java Animation.java AFrame.java cubeWorker.java layerEditFrame.java Led3D.java Frame.java
9
+
10
+# Files that go in the jar
11
+INJAR = *.class *.png
12
+
13
+
14
+all: CubeControl.jar
15
+
16
+doc: doc/index.html
17
+
18
+CubeControl.jar: libSerial HelperUtility.class manifest.txt
19
+	jar -cmf manifest.txt "CubeControl.jar" $(INJAR)
20
+
21
+serialInterface.h: HelperUtility.class
22
+	javah -o serialInterface.h HelperUtility
23
+
24
+HelperUtility.class: $(JAVAFILES)
25
+	javac $(JAVAFILES)
26
+
27
+# SystemRoot is only defined in Windows
28
+ifdef SystemRoot
29
+libSerial: Serial.dll
30
+$(RM) = del
31
+else
32
+libSerial: libSerial.jnilib
33
+$(RM) = rm -f
34
+endif
35
+
36
+libSerial.jnilib: serialHelper.c helper/unixSerial.c serialInterface.h
37
+	$(CC) -x c -I$(HEADERPATH) -c serialHelper.c -o serialHelper.o
38
+	$(CC) -dynamiclib -o libSerial.jnilib serialHelper.o
39
+	rm -f serialHelper.o
40
+
41
+Serial.dll: serialHelper.c helper/winSerial.c serialInterface.h
42
+	$(CC) -x c -I$(HEADERPATH) -c serialHelper.c -o serialHelper.o -D winHelper
43
+	$(CC) -dynamiclib -o Serial.dll serialHelper.o
44
+	del serialHelper.o
45
+
46
+doc/index.html: $(JAVAFILES)
47
+	javadoc -d doc $(JAVAFILES)
48
+
49
+# Delete intermediate files
50
+clean:
51
+	$(RM) *.class
52
+	$(RM) *.h
53
+	$(RM) *.o
54
+	$(RM) *.jar
55
+ifdef SystemRoot
56
+	$(RM) *.dll
57
+else
58
+	$(RM) *.jnilib
59
+endif

Cube Control/manifest.txt → CubeControl/manifest.txt View File


Cube Control/serialHelper.c → CubeControl/serialHelper.c View File


Cube Control/splash.png → CubeControl/splash.png View File


Cube Firmware/cube.c → CubeFirmware/cube.c View File


Cube Firmware/cube.h → CubeFirmware/cube.h View File


Cube Firmware/main.c → CubeFirmware/main.c View File


Cube Firmware/makefile → CubeFirmware/makefile View File


Cube Firmware/twi.c → CubeFirmware/twi.c View File


Cube Firmware/twi.h → CubeFirmware/twi.h View File


Cube Firmware/uart.c → CubeFirmware/uart.c View File


Cube Firmware/uart.h → CubeFirmware/uart.h View File


+ 27
- 0
makefile View File

@@ -0,0 +1,27 @@
1
+all: Control Firmware
2
+
3
+Control:
4
+	make -C CubeControl
5
+	mv CubeControl/CubeControl.jar CubeControl.jar
6
+ifdef SystemRoot
7
+	mv CubeControl/Serial.dll Serial.dll
8
+else
9
+	mv CubeControl/libSerial.jnilib libSerial.jnilib
10
+endif
11
+	make -C CubeControl clean
12
+
13
+Firmware:
14
+	make -C CubeFirmware
15
+	mv CubeFirmware/main.hex CubeFirmware.hex
16
+	make -C CubeFirmware clean
17
+
18
+clean:
19
+ifdef SystemRoot
20
+	del CubeControl.jar
21
+	del CubeFirmware.hex
22
+	del Serial.dll
23
+else
24
+	rm -f CubeControl.jar
25
+	rm -f CubeFirmware.hex
26
+	rm -f libSerial.jnilib
27
+endif

Loading…
Cancel
Save