-
Notifications
You must be signed in to change notification settings - Fork 4
/
gcc-exec.template
71 lines (70 loc) · 1.73 KB
/
gcc-exec.template
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
<h1 style="margin: 0; padding: 0; text-align: center;">GCC-exec</h1>
<h3 style="color: blue;">by Martin Ribelotta</h3>
<p>This template includes:</p>
<ul>
<li>A basic C example to run in your PC</li>
</ul>
diff -Naur -x '.git*' -x '*.o' -x '*.d' -x '*.elf' -x '*.lst' -x '*.map' -x '.config*' -x '*.conf' -x autoconf.h a_16VwRS/inc/main.h ./inc/main.h
--- a_16VwRS/inc/main.h 1969-12-31 21:00:00.000000000 -0300
+++ ./inc/main.h 2016-06-13 21:59:46.233953335 -0300
@@ -0,0 +1,8 @@
+#ifndef __MAIN_H__
+#define __MAIN_H__
+
+/*
+ * Add definitions here
+ */
+
+#endif
diff -Naur -x '.git*' -x '*.o' -x '*.d' -x '*.elf' -x '*.lst' -x '*.map' -x '.config*' -x '*.conf' -x autoconf.h a_16VwRS/Makefile ./Makefile
--- a_16VwRS/Makefile 1969-12-31 21:00:00.000000000 -0300
+++ ./Makefile 2016-06-13 22:07:40.137966026 -0300
@@ -0,0 +1,39 @@
+EXEC=${{ExecName string:program-name}}
+CSRC=$(wildcard src/*.c)
+CCSRC=$(wildcard src/*.cpp)
+
+OBJS=$(CSRC:.c=.o) $(CCSRC:.cpp=.o)
+
+DEPS=$(OBJS:.o=.d)
+
+CROSS=
+CC=$(CROSS)gcc
+CXX=$(CROSS)g++
+
+ifeq ($(strip $(CCSRC)),)
+LD=$(CROSS)gcc
+else
+LD=$(CROSS)g++
+endif
+
+all: $(EXEC)
+
+.PHONY: all clean
+
+-include $(DEPS)
+
+%.o: %.c
+ @echo "CC $^"
+ @$(CC) -MMD -c $(CFLAGS) -o $@ $^
+
+%.o: %.cpp
+ @echo "CXX $^"
+ @$(CXX) -MMD -c $(CFLAGS) $(CXXFLAGS) -o $@ $^
+
+$(EXEC): $(OBJS)
+ @echo "LD $@"
+ @$(LD) -o $@ $(LDFLAGS) $<
+
+clean:
+ @echo "CLEAN"
+ @rm -fR $(OBJS) $(DEPS) $(EXEC)
diff -Naur -x '.git*' -x '*.o' -x '*.d' -x '*.elf' -x '*.lst' -x '*.map' -x '.config*' -x '*.conf' -x autoconf.h a_16VwRS/src/main.c ./src/main.c
--- a_16VwRS/src/main.c 1969-12-31 21:00:00.000000000 -0300
+++ ./src/main.c 2016-06-13 21:59:00.661952114 -0300
@@ -0,0 +1,5 @@
+
+int main(int argc, char **argv)
+{
+ return 0;
+}