c_project 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/c_project +105 -17
- data/lib/c_project/version.rb +1 -1
- data/templates/c/Makefile.tt +150 -0
- data/templates/{README.md.tt → c/README.md.tt} +0 -0
- data/templates/{src → c/src}/CExceptionConfig.h.tt +0 -0
- data/templates/{src → c/src}/c_project.c.tt +0 -0
- data/templates/{src → c/src}/c_project.h.tt +0 -0
- data/templates/{src → c/src}/main.c.tt +0 -0
- data/templates/{test → c/test}/support/test_helper.c.tt +0 -0
- data/templates/{test → c/test}/support/test_helper.h.tt +0 -0
- data/templates/{test → c/test}/test_c_project.c.tt +0 -0
- data/templates/{vendor → c/vendor}/cexception/docs/license.txt +0 -0
- data/templates/{vendor → c/vendor}/cexception/docs/readme.txt +0 -0
- data/templates/{vendor → c/vendor}/cexception/lib/CException.c +0 -0
- data/templates/{vendor → c/vendor}/cexception/lib/CException.h +0 -0
- data/templates/{vendor → c/vendor}/cexception/release/build.info +0 -0
- data/templates/{vendor → c/vendor}/cexception/release/version.info +0 -0
- data/templates/c/vendor/timer/LICENCE +23 -0
- data/templates/c/vendor/timer/README.md +8 -0
- data/templates/c/vendor/timer/src/timer.c +27 -0
- data/templates/c/vendor/timer/src/timer.h +7 -0
- data/templates/{vendor → c/vendor}/unity/.gitignore +0 -0
- data/templates/{vendor → c/vendor}/unity/auto/colour_prompt.rb +0 -0
- data/templates/{vendor → c/vendor}/unity/auto/colour_reporter.rb +0 -0
- data/templates/{vendor → c/vendor}/unity/auto/generate_config.yml +0 -0
- data/templates/{vendor → c/vendor}/unity/auto/generate_module.rb +0 -0
- data/templates/{vendor → c/vendor}/unity/auto/generate_test_runner.rb +0 -0
- data/templates/{vendor → c/vendor}/unity/auto/test_file_filter.rb +0 -0
- data/templates/{vendor → c/vendor}/unity/auto/unity_test_summary.rb +0 -0
- data/templates/{vendor → c/vendor}/unity/docs/Unity Summary.txt +0 -0
- data/templates/{vendor → c/vendor}/unity/docs/license.txt +0 -0
- data/templates/{vendor → c/vendor}/unity/release/build.info +0 -0
- data/templates/{vendor → c/vendor}/unity/release/version.info +0 -0
- data/templates/{vendor → c/vendor}/unity/src/unity.c +0 -0
- data/templates/{vendor → c/vendor}/unity/src/unity.h +0 -0
- data/templates/{vendor → c/vendor}/unity/src/unity_internals.h +0 -0
- data/templates/{vendor/commander.c → commander.c}/History.md +0 -0
- data/templates/{vendor/commander.c → commander.c}/Makefile +0 -0
- data/templates/{vendor/commander.c → commander.c}/Readme.md +0 -0
- data/templates/{vendor/commander.c → commander.c}/package.json +0 -0
- data/templates/{vendor/commander.c → commander.c}/src/commander.c +0 -0
- data/templates/{vendor/commander.c → commander.c}/src/commander.h +0 -0
- data/templates/{vendor/commander.c → commander.c}/test.c +0 -0
- metadata +43 -39
- data/templates/Makefile.tt +0 -74
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f077249f45ad2c626eccf6af687d6279f4263fc
|
4
|
+
data.tar.gz: ebe32b2737e48ad6b8225a6f6b8e095046fb5fa2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 626f3eeed41a89e0cf5abd99962999fe9fc4c25306b39f9ab7ccb284aa8536e98542c1b7e5ca0238dfffb26239bf4d5622931700bf5705f2844261af06ba2590
|
7
|
+
data.tar.gz: 97c8ebd7531a73910f737bb79048b0347800a35dac8224ef82d92dd6bf34912ee2579c65675d731225d13a7c9be63575ce002402dc4a109f32b643e0ef249863
|
data/bin/c_project
CHANGED
@@ -4,7 +4,7 @@ require 'thor'
|
|
4
4
|
require 'date'
|
5
5
|
|
6
6
|
module CProject
|
7
|
-
class
|
7
|
+
class NewProject < Thor::Group
|
8
8
|
include Thor::Actions
|
9
9
|
|
10
10
|
argument :name, :desc => 'Name of the new project.'
|
@@ -18,20 +18,46 @@ module CProject
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def fill_root
|
21
|
-
|
21
|
+
empty_directory file_path('bin')
|
22
|
+
empty_directory file_path('experiments')
|
23
|
+
empty_directory file_path('scripts')
|
24
|
+
create_file_from_shared_template "LICENCE"
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def header_guard
|
30
|
+
"__#{name.upcase}_H__"
|
31
|
+
end
|
32
|
+
|
33
|
+
def file_path(file_name)
|
34
|
+
File.join name, file_name
|
35
|
+
end
|
36
|
+
|
37
|
+
def create_file_from_shared_template(file_name)
|
38
|
+
template(
|
39
|
+
"templates/#{file_name}.tt",
|
40
|
+
file_path(file_name)
|
41
|
+
)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
class C < NewProject
|
46
|
+
def fill_root
|
47
|
+
super
|
22
48
|
create_file_from_template "README.md"
|
23
49
|
create_file_from_template "Makefile"
|
24
50
|
end
|
25
51
|
|
26
52
|
def src
|
27
53
|
create_file_from_template 'src/CExceptionConfig.h'
|
28
|
-
template 'templates/src/c_project.c.tt', file_path("src/#{name}.c")
|
29
|
-
template 'templates/src/c_project.h.tt', file_path("src/#{name}.h")
|
54
|
+
template 'templates/c/src/c_project.c.tt', file_path("src/#{name}.c")
|
55
|
+
template 'templates/c/src/c_project.h.tt', file_path("src/#{name}.h")
|
30
56
|
create_file_from_template 'src/main.c'
|
31
57
|
end
|
32
58
|
|
33
59
|
def test
|
34
|
-
template 'templates/test/test_c_project.c.tt', file_path("test/test_#{name}.c")
|
60
|
+
template 'templates/c/test/test_c_project.c.tt', file_path("test/test_#{name}.c")
|
35
61
|
end
|
36
62
|
|
37
63
|
def support
|
@@ -40,37 +66,99 @@ module CProject
|
|
40
66
|
end
|
41
67
|
|
42
68
|
def vendor
|
43
|
-
directory 'templates/vendor', file_path("vendor")
|
69
|
+
directory 'templates/c/vendor', file_path("vendor")
|
70
|
+
directory 'templates/commander.c', file_path('vendor/commander.c')
|
44
71
|
end
|
45
72
|
|
46
73
|
private
|
47
74
|
|
48
|
-
def
|
49
|
-
|
75
|
+
def create_file_from_template(file_name)
|
76
|
+
template(
|
77
|
+
"templates/c/#{file_name}.tt",
|
78
|
+
file_path(file_name)
|
79
|
+
)
|
50
80
|
end
|
51
81
|
|
52
|
-
def
|
53
|
-
|
82
|
+
def extension
|
83
|
+
'c'
|
54
84
|
end
|
55
85
|
|
86
|
+
def compiler
|
87
|
+
'CC'
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
class Cpp < Thor::Group
|
92
|
+
include Thor::Actions
|
93
|
+
|
94
|
+
argument :name, :desc => 'Name of the new project.'
|
95
|
+
|
96
|
+
def self.source_root
|
97
|
+
File.expand_path('../../', __FILE__)
|
98
|
+
end
|
99
|
+
|
100
|
+
def fill_root
|
101
|
+
super
|
102
|
+
create_file_from_template "README.md"
|
103
|
+
create_file_from_template "Makefile"
|
104
|
+
end
|
105
|
+
|
106
|
+
# @todo
|
107
|
+
# def src
|
108
|
+
# create_file_from_template 'src/CExceptionConfig.h'
|
109
|
+
# template 'templates/src/c_project.c.tt', file_path("src/#{name}.c")
|
110
|
+
# template 'templates/src/c_project.h.tt', file_path("src/#{name}.h")
|
111
|
+
# create_file_from_template 'src/main.c'
|
112
|
+
# end
|
113
|
+
|
114
|
+
# def test
|
115
|
+
# template 'templates/test/test_c_project.c.tt', file_path("test/test_#{name}.c")
|
116
|
+
# end
|
117
|
+
|
118
|
+
# def support
|
119
|
+
# create_file_from_template 'test/support/test_helper.c'
|
120
|
+
# create_file_from_template 'test/support/test_helper.h'
|
121
|
+
# end
|
122
|
+
|
123
|
+
# def vendor
|
124
|
+
# directory 'templates/vendor', file_path("vendor")
|
125
|
+
# end
|
126
|
+
|
127
|
+
private
|
128
|
+
|
56
129
|
def create_file_from_template(file_name)
|
57
130
|
template(
|
58
|
-
"templates/#{file_name}.tt",
|
131
|
+
"templates/cpp/#{file_name}.tt",
|
59
132
|
file_path(file_name)
|
60
133
|
)
|
61
134
|
end
|
135
|
+
|
136
|
+
def extension
|
137
|
+
'cpp'
|
138
|
+
end
|
139
|
+
|
140
|
+
def compiler
|
141
|
+
'CCPP'
|
142
|
+
end
|
62
143
|
end
|
63
144
|
|
64
145
|
class CProject < Thor
|
65
|
-
map 'n' => :new
|
66
|
-
|
67
146
|
register(
|
68
|
-
|
69
|
-
'
|
70
|
-
'
|
147
|
+
C,
|
148
|
+
'c',
|
149
|
+
'c NAME',
|
71
150
|
"Creates a new C project the name NAME"
|
72
151
|
)
|
73
|
-
tasks["
|
152
|
+
tasks["c"].options = C.class_options
|
153
|
+
|
154
|
+
# @todo
|
155
|
+
# register(
|
156
|
+
# Cpp,
|
157
|
+
# 'c++',
|
158
|
+
# 'c++ NAME',
|
159
|
+
# "Creates a new C++ project the name NAME"
|
160
|
+
# )
|
161
|
+
# tasks["c++"].options = Cpp.class_options
|
74
162
|
end
|
75
163
|
end
|
76
164
|
|
data/lib/c_project/version.rb
CHANGED
@@ -0,0 +1,150 @@
|
|
1
|
+
# More precise but typically not necessary and more verbose
|
2
|
+
#THIS_DIR := $(CURDIR)/$(dir $(lastword $(MAKEFILE_LIST)))
|
3
|
+
THIS_DIR := ./
|
4
|
+
|
5
|
+
# Project definitions
|
6
|
+
#====================
|
7
|
+
TARGET_BASE = <%= name %>
|
8
|
+
TARGET := $(THIS_DIR)/bin/$(TARGET_BASE)
|
9
|
+
default: $(TARGET)
|
10
|
+
|
11
|
+
OBJ_DIR = $(THIS_DIR)/obj
|
12
|
+
$(OBJ_DIR):
|
13
|
+
-mkdir $(THIS_DIR)/obj
|
14
|
+
|
15
|
+
SRC_DIR := $(THIS_DIR)/src
|
16
|
+
SRC_INCLUDES := -I$(SRC_DIR)
|
17
|
+
|
18
|
+
# Compiler definitions
|
19
|
+
#======================
|
20
|
+
CC = gcc -std=gnu99
|
21
|
+
CCPP = g++ -std=gnu++0x
|
22
|
+
|
23
|
+
COMPILER := $(<%= compiler %>)
|
24
|
+
|
25
|
+
DEBUG_SYMBOLS = -g
|
26
|
+
|
27
|
+
TO_OBJ = -c
|
28
|
+
|
29
|
+
TO_FILE = -o
|
30
|
+
|
31
|
+
# Preprocess out asserts
|
32
|
+
NO_ASSERTS = -DNDEBUG
|
33
|
+
|
34
|
+
# Enable print log
|
35
|
+
PRINT_LOG = -DPRINTLOG
|
36
|
+
|
37
|
+
OPTIMIZATION = -O1
|
38
|
+
|
39
|
+
WARNINGS = -Wall
|
40
|
+
|
41
|
+
CEXCEPTION_CONFIGURATION = -DCEXCEPTION_USE_CONFIG_FILE
|
42
|
+
|
43
|
+
# CC options concatenated together
|
44
|
+
FLAGS := $(WARNINGS) $(DEBUG_SYMBOLS) $(OPTIMIZATION) $(PRINT_LOG) $(CEXCEPTION_CONFIGURATION)
|
45
|
+
|
46
|
+
LIBS = -lm
|
47
|
+
|
48
|
+
# Vendor definitions
|
49
|
+
#=======================
|
50
|
+
VENDOR_DIR := $(THIS_DIR)/vendor/
|
51
|
+
|
52
|
+
# Commander
|
53
|
+
#----------
|
54
|
+
COMMANDER_SRC_DIR := $(VENDOR_DIR)/commander.c/src
|
55
|
+
COMMANDER_INCLUDES := -I$(COMMANDER_SRC_DIR)
|
56
|
+
COMMANDER_SRC := $(COMMANDER_SRC_DIR)/commander.c
|
57
|
+
COMMANDER_OBJ := $(OBJ_DIR)/commander.o
|
58
|
+
$(COMMANDER_OBJ): $(COMMANDER_SRC) $(OBJ_DIR)
|
59
|
+
$(CC) $(TO_OBJ) $(FLAGS) $(TO_FILE) $@ $< $(COMMANDER_INCLUDES)
|
60
|
+
|
61
|
+
# CException
|
62
|
+
#-----------
|
63
|
+
CEXCEPTION_SRC_DIR := $(VENDOR_DIR)/cexception/lib
|
64
|
+
CEXCEPTION_INCLUDES := -I$(CEXCEPTION_SRC_DIR)
|
65
|
+
CEXCEPTION_SRC := $(CEXCEPTION_SRC_DIR)/CException.c
|
66
|
+
CEXCEPTION_OBJ := $(OBJ_DIR)/CException.o
|
67
|
+
$(CEXCEPTION_OBJ): $(CEXCEPTION_SRC) $(OBJ_DIR)
|
68
|
+
$(CC) $(TO_OBJ) $(FLAGS) $(TO_FILE) $@ $< $(CEXCEPTION_INCLUDES) $(SRC_INCLUDES)
|
69
|
+
|
70
|
+
# Timer
|
71
|
+
#-----------
|
72
|
+
TIMER_SRC_DIR := $(VENDOR_DIR)/timer/src
|
73
|
+
TIMER_INCLUDES := -I$(TIMER_SRC_DIR)
|
74
|
+
TIMER_SRC := $(TIMER_SRC_DIR)/timer.c
|
75
|
+
TIMER_OBJ := $(OBJ_DIR)/timer.o
|
76
|
+
$(TIMER_OBJ): $(TIMER_SRC) $(OBJ_DIR)
|
77
|
+
$(CC) $(TO_OBJ) $(FLAGS) $(TO_FILE) $@ $< $(TIMER_INCLUDES) $(SRC_INCLUDES)
|
78
|
+
|
79
|
+
|
80
|
+
# Concatenated includes and objects
|
81
|
+
#----------------------------------
|
82
|
+
VENDOR_INCLUDES := $(COMMANDER_INCLUDES) $(CEXCEPTION_INCLUDES) $(TIMER_INCLUDES)
|
83
|
+
VENDOR_OBJS := $(COMMANDER_OBJ) $(CEXCEPTION_OBJ) $(TIMER_OBJ)
|
84
|
+
|
85
|
+
# Project
|
86
|
+
#========
|
87
|
+
INCLUDES := $(VENDOR_INCLUDES) $(SRC_INCLUDES)
|
88
|
+
|
89
|
+
# Main
|
90
|
+
#-----
|
91
|
+
MAIN_SRC := $(SRC_DIR)/main.<%= extension %>
|
92
|
+
MAIN_OBJ := $(OBJ_DIR)/main.o
|
93
|
+
$(MAIN_OBJ): $(MAIN_SRC) $(OBJ_DIR)
|
94
|
+
$(COMPILER) $(TO_OBJ) $(FLAGS) $(TO_FILE) $@ $< $(INCLUDES)
|
95
|
+
|
96
|
+
# Concatenated objects
|
97
|
+
#---------------------
|
98
|
+
PROJECT_OBJS :=
|
99
|
+
|
100
|
+
# Target
|
101
|
+
#-------
|
102
|
+
$(TARGET): $(MAIN_OBJ) $(PROJECT_OBJS) $(VENDOR_OBJS)
|
103
|
+
$(COMPILER) $(TO_FILE) $@ $^ $(LIBS)
|
104
|
+
chmod 755 $@
|
105
|
+
|
106
|
+
|
107
|
+
# Testing
|
108
|
+
#===========
|
109
|
+
UNITY_DIR := $(VENDOR_DIR)/unity
|
110
|
+
UNITY_SRC_DIR := $(UNITY_DIR)/src
|
111
|
+
TEST_DIR := $(THIS_DIR)/test
|
112
|
+
TEST_SUPPORT_DIR := $(TEST_DIR)/support
|
113
|
+
TEST_INCLUDES := -I$(UNITY_SRC_DIR) -I$(TEST_SUPPORT_DIR) $(INCLUDES)
|
114
|
+
SYMBOLS = -DTEST -DUNITY_FLOAT_TYPE=double -DUNITY_FLOAT_VERBOSE
|
115
|
+
|
116
|
+
TEST_BASE := $(TEST_DIR)/test_$(TARGET_BASE)
|
117
|
+
ifeq ($(OS),Windows_NT)
|
118
|
+
TEST_EXTENSION=.exe
|
119
|
+
else
|
120
|
+
TEST_EXTENSION=.out
|
121
|
+
endif
|
122
|
+
|
123
|
+
# Test 1
|
124
|
+
#-------------
|
125
|
+
TEST1_BASE := $(TEST_BASE)
|
126
|
+
TEST1_SRC := $(TEST1_BASE).c
|
127
|
+
TEST1 := $(TEST1_BASE)$(TEST_EXTENSION)
|
128
|
+
TEST1_RUNNER := $(TEST1_BASE)_Runner.c
|
129
|
+
|
130
|
+
$(TEST1_RUNNER): $(TEST1_SRC)
|
131
|
+
ruby $(UNITY_DIR)/auto/generate_test_runner.rb $(TEST1_SRC) $(TEST1_RUNNER)
|
132
|
+
|
133
|
+
$(TEST1): $(TEST1_RUNNER) $(PROJECT_OBJS) $(VENDOR_OBJS)
|
134
|
+
$(COMPILER) $(TO_FILE) $@ $^ $(TEST_SUPPORT_DIR)/test_helper.c $(UNITY_SRC_DIR)/unity.c $(TEST1_SRC) $(TEST_INCLUDES) $(LIBS)
|
135
|
+
chmod 755 $@
|
136
|
+
|
137
|
+
# Automatic tests (require Ruby)
|
138
|
+
#--------------------------------
|
139
|
+
test: clean $(TEST1)
|
140
|
+
$(TEST1)
|
141
|
+
|
142
|
+
# Clean
|
143
|
+
#============
|
144
|
+
clean:
|
145
|
+
-rm -fr $(TARGET) obj *.out $(THIS_DIR)/test/*.out core.*
|
146
|
+
|
147
|
+
# Makefile debugging
|
148
|
+
#===================
|
149
|
+
print-%:
|
150
|
+
@echo $* = $($*)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,23 @@
|
|
1
|
+
Copyright (C) 2013
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
4
|
+
this software and associated documentation files (the "Software"), to deal in
|
5
|
+
the Software without restriction, including without limitation the rights to
|
6
|
+
use, copy, modify, merge, publish, distribute, sublicence, and/or sell copies
|
7
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
8
|
+
so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
11
|
+
copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
Except as contained in this notice, the name(s) of the above copyright holders
|
14
|
+
shall not be used in advertising or otherwise to promote the sale, use or other
|
15
|
+
dealings in this Software without prior written authorization.
|
16
|
+
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23
|
+
SOFTWARE.
|
@@ -0,0 +1,27 @@
|
|
1
|
+
#include <stdlib.h>
|
2
|
+
#include <assert.h>
|
3
|
+
#include <sys/time.h>
|
4
|
+
#include "timer.h"
|
5
|
+
|
6
|
+
static struct timeval before, after;
|
7
|
+
|
8
|
+
void start_timer() {
|
9
|
+
before.tv_sec = 0;
|
10
|
+
before.tv_usec = 0;
|
11
|
+
after.tv_sec = 0;
|
12
|
+
after.tv_usec = 0;
|
13
|
+
|
14
|
+
gettimeofday(&before, NULL);
|
15
|
+
}
|
16
|
+
long long stop_timer() {
|
17
|
+
gettimeofday(&after, NULL);
|
18
|
+
|
19
|
+
// Two subtractions can be done here without decreasing stability because
|
20
|
+
// tv_sec and tv_usec are not floating point format. Doing the subtractions
|
21
|
+
// separately before the multiplication and addition reduces the
|
22
|
+
// possibility of overflow.
|
23
|
+
return (
|
24
|
+
(after.tv_sec - before.tv_sec) * 1e6 +
|
25
|
+
(after.tv_usec - before.tv_usec)
|
26
|
+
);
|
27
|
+
}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: c_project
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dustin Morrill
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-12-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -70,43 +70,47 @@ files:
|
|
70
70
|
- lib/c_project.rb
|
71
71
|
- lib/c_project/version.rb
|
72
72
|
- templates/LICENCE.tt
|
73
|
-
- templates/Makefile.tt
|
74
|
-
- templates/README.md.tt
|
75
|
-
- templates/src/CExceptionConfig.h.tt
|
76
|
-
- templates/src/c_project.c.tt
|
77
|
-
- templates/src/c_project.h.tt
|
78
|
-
- templates/src/main.c.tt
|
79
|
-
- templates/test/support/test_helper.c.tt
|
80
|
-
- templates/test/support/test_helper.h.tt
|
81
|
-
- templates/test/test_c_project.c.tt
|
82
|
-
- templates/vendor/cexception/docs/license.txt
|
83
|
-
- templates/vendor/cexception/docs/readme.txt
|
84
|
-
- templates/vendor/cexception/lib/CException.c
|
85
|
-
- templates/vendor/cexception/lib/CException.h
|
86
|
-
- templates/vendor/cexception/release/build.info
|
87
|
-
- templates/vendor/cexception/release/version.info
|
88
|
-
- templates/vendor/
|
89
|
-
- templates/vendor/
|
90
|
-
- templates/vendor/
|
91
|
-
- templates/vendor/
|
92
|
-
- templates/
|
93
|
-
- templates/vendor/
|
94
|
-
- templates/vendor/
|
95
|
-
- templates/vendor/unity
|
96
|
-
- templates/vendor/unity/auto/
|
97
|
-
- templates/vendor/unity/auto/
|
98
|
-
- templates/vendor/unity/auto/
|
99
|
-
- templates/vendor/unity/auto/
|
100
|
-
- templates/vendor/unity/
|
101
|
-
- templates/vendor/unity/
|
102
|
-
- templates/vendor/unity/
|
103
|
-
- templates/vendor/unity/
|
104
|
-
- templates/vendor/unity/
|
105
|
-
- templates/vendor/unity/
|
106
|
-
- templates/vendor/unity/
|
107
|
-
- templates/
|
108
|
-
- templates/
|
109
|
-
- templates/
|
73
|
+
- templates/c/Makefile.tt
|
74
|
+
- templates/c/README.md.tt
|
75
|
+
- templates/c/src/CExceptionConfig.h.tt
|
76
|
+
- templates/c/src/c_project.c.tt
|
77
|
+
- templates/c/src/c_project.h.tt
|
78
|
+
- templates/c/src/main.c.tt
|
79
|
+
- templates/c/test/support/test_helper.c.tt
|
80
|
+
- templates/c/test/support/test_helper.h.tt
|
81
|
+
- templates/c/test/test_c_project.c.tt
|
82
|
+
- templates/c/vendor/cexception/docs/license.txt
|
83
|
+
- templates/c/vendor/cexception/docs/readme.txt
|
84
|
+
- templates/c/vendor/cexception/lib/CException.c
|
85
|
+
- templates/c/vendor/cexception/lib/CException.h
|
86
|
+
- templates/c/vendor/cexception/release/build.info
|
87
|
+
- templates/c/vendor/cexception/release/version.info
|
88
|
+
- templates/c/vendor/timer/LICENCE
|
89
|
+
- templates/c/vendor/timer/README.md
|
90
|
+
- templates/c/vendor/timer/src/timer.c
|
91
|
+
- templates/c/vendor/timer/src/timer.h
|
92
|
+
- templates/c/vendor/unity/.gitignore
|
93
|
+
- templates/c/vendor/unity/auto/colour_prompt.rb
|
94
|
+
- templates/c/vendor/unity/auto/colour_reporter.rb
|
95
|
+
- templates/c/vendor/unity/auto/generate_config.yml
|
96
|
+
- templates/c/vendor/unity/auto/generate_module.rb
|
97
|
+
- templates/c/vendor/unity/auto/generate_test_runner.rb
|
98
|
+
- templates/c/vendor/unity/auto/test_file_filter.rb
|
99
|
+
- templates/c/vendor/unity/auto/unity_test_summary.rb
|
100
|
+
- templates/c/vendor/unity/docs/Unity Summary.txt
|
101
|
+
- templates/c/vendor/unity/docs/license.txt
|
102
|
+
- templates/c/vendor/unity/release/build.info
|
103
|
+
- templates/c/vendor/unity/release/version.info
|
104
|
+
- templates/c/vendor/unity/src/unity.c
|
105
|
+
- templates/c/vendor/unity/src/unity.h
|
106
|
+
- templates/c/vendor/unity/src/unity_internals.h
|
107
|
+
- templates/commander.c/History.md
|
108
|
+
- templates/commander.c/Makefile
|
109
|
+
- templates/commander.c/Readme.md
|
110
|
+
- templates/commander.c/package.json
|
111
|
+
- templates/commander.c/src/commander.c
|
112
|
+
- templates/commander.c/src/commander.h
|
113
|
+
- templates/commander.c/test.c
|
110
114
|
homepage: https://github.com/dmorrill10/c_project
|
111
115
|
licenses:
|
112
116
|
- MIT
|
data/templates/Makefile.tt
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
THIS_DIR := $(CURDIR)/$(dir $(lastword $(MAKEFILE_LIST)))
|
2
|
-
|
3
|
-
CC = gcc -std=gnu99
|
4
|
-
CFLAGS = -O3 -g -Wall
|
5
|
-
LIBS = -lm
|
6
|
-
TARGET_SYMBOLS = -DCEXCEPTION_USE_CONFIG_FILE
|
7
|
-
|
8
|
-
VENDOR_DIR := $(THIS_DIR)/vendor/
|
9
|
-
COMMANDER_DIR := $(VENDOR_DIR)/commander.c
|
10
|
-
TARGET_INCLUDES = -I$(THIS_DIR)/src -I$(CEXCEPTION_LIB) -I$(COMMANDER_DIR)/src
|
11
|
-
|
12
|
-
CEXCEPTION_DIR := $(VENDOR_DIR)/cexception/
|
13
|
-
CEXCEPTION_LIB := $(CEXCEPTION_DIR)/lib
|
14
|
-
CEXCEPTION_SRC := $(CEXCEPTION_LIB)/CException.c
|
15
|
-
|
16
|
-
TARGET_BASE = <%= name %>
|
17
|
-
TARGET_SRC_DIR := $(THIS_DIR)/src
|
18
|
-
TARGET_SRC := $(TARGET_SRC_DIR)/$(TARGET_BASE).c $(CEXCEPTION_SRC)
|
19
|
-
|
20
|
-
BUILD_PREFIX := $(CC) $(CFLAGS) $(TARGET_SYMBOLS)
|
21
|
-
|
22
|
-
TARGET := $(THIS_DIR)/$(TARGET_BASE)
|
23
|
-
|
24
|
-
default: $(TARGET)
|
25
|
-
|
26
|
-
# Build target
|
27
|
-
#==============
|
28
|
-
$(TARGET): $(TARGET_SRC)
|
29
|
-
$(BUILD_PREFIX) $(TARGET_INCLUDES) $(TARGET_SRC) $(TARGET_SRC_DIR)/main.c $(COMMANDER_DIR)/src/commander.c $(PROJECT_SRC) $(LIBS) -o $@
|
30
|
-
chmod 755 $@
|
31
|
-
|
32
|
-
# Testing
|
33
|
-
#===========
|
34
|
-
UNITY_DIR := $(VENDOR_DIR)/unity
|
35
|
-
TEST_DIR := $(THIS_DIR)/test
|
36
|
-
TEST_SUPPORT_DIR := $(TEST_DIR)/support
|
37
|
-
INC_DIRS := -I$(UNITY_DIR)/src -I$(TEST_SUPPORT_DIR) -I$(THIS_DIR)/src $(TARGET_INCLUDES)
|
38
|
-
SYMBOLS = -DTEST -DUNITY_FLOAT_TYPE=double -DUNITY_FLOAT_VERBOSE
|
39
|
-
TEST_BASE := $(TEST_DIR)/test_$(TARGET_BASE)
|
40
|
-
ifeq ($(OS),Windows_NT)
|
41
|
-
TEST_EXTENSION=.exe
|
42
|
-
else
|
43
|
-
TEST_EXTENSION=.out
|
44
|
-
endif
|
45
|
-
|
46
|
-
# Test 1
|
47
|
-
#-------------
|
48
|
-
TEST1_BASE := $(TEST_BASE)
|
49
|
-
TEST1_SRC := $(TEST1_BASE).c
|
50
|
-
TEST1 := $(TEST1_BASE)$(TEST_EXTENSION)
|
51
|
-
TEST1_RUNNER := $(TEST1_BASE)_Runner.c
|
52
|
-
|
53
|
-
$(TEST1_RUNNER): $(TEST1_SRC)
|
54
|
-
ruby $(UNITY_DIR)/auto/generate_test_runner.rb $(TEST1_SRC) $(TEST1_RUNNER)
|
55
|
-
|
56
|
-
$(TEST1): $(TARGET) $(TEST1_RUNNER)
|
57
|
-
$(BUILD_PREFIX) $(SYMBOLS) $(INC_DIRS) $(TARGET_SRC) $(PROJECT_SRC) $(TEST_SUPPORT_DIR)/test_helper.c $(UNITY_DIR)/src/unity.c $(TEST1_SRC) $(TEST1_RUNNER) $(LIBS) -o $@
|
58
|
-
chmod 755 $@
|
59
|
-
|
60
|
-
# Automatic tests (require Ruby)
|
61
|
-
#--------------------------------
|
62
|
-
test: clean $(TEST1)
|
63
|
-
$(TEST1)
|
64
|
-
|
65
|
-
# Clean
|
66
|
-
#============
|
67
|
-
clean:
|
68
|
-
rm -f $(TARGET) *.o *.il *.out $(TEST1) $(TEST1_RUNNER) $(THIS_DIR)/test/*.out
|
69
|
-
|
70
|
-
# Makefile debugging
|
71
|
-
#===================
|
72
|
-
print-%:
|
73
|
-
@echo $* = $($*)
|
74
|
-
|