simple-make 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,12 @@
1
+ require "simple-make/dependency_project"
2
+
3
+ class ProjectFactory
4
+ def self.create_from_relative_path options
5
+ build_file_path = options[:relative_path] + "/build.sm"
6
+ raise "#{build_file_path} doesn't exist, cannot depend on project #{options[:relative_path]}, abort!" if !File.exist? build_file_path
7
+
8
+ project = Project.new workspace: File.absolute_path(options[:relative_path])
9
+ project.instance_eval(File.open(build_file_path).read)
10
+ DependencyProject.new(project, options)
11
+ end
12
+ end
@@ -0,0 +1,7 @@
1
+ require "simple-make/normal_makefile_maker"
2
+
3
+ class RootMakefileMaker < NormalMakefileMaker
4
+ def initialize project, context
5
+ super project, context, "root_makefile"
6
+ end
7
+ end
@@ -1,9 +1,13 @@
1
+ require "simple-make/path_helper"
2
+
1
3
  class SearchPath
4
+ include PathHelper
2
5
  attr_reader :path, :scope
3
- def initialize map
6
+
7
+ def initialize map, path_mode = :absolute
4
8
  raise wrong_format_msg(map) if !(map.is_a? Hash) or map[:path].nil?
5
9
 
6
- @path = File.absolute_path(map[:path])
10
+ @path = get_path(path_mode, map[:path])
7
11
  @scope = map[:scope] || :compile
8
12
  end
9
13
 
@@ -0,0 +1,4 @@
1
+ require "logger"
2
+
3
+ $std_logger = Logger.new(STDOUT)
4
+ $std_logger.level = Logger::INFO
@@ -0,0 +1,11 @@
1
+ class Template
2
+ TEMPLATE_BASE_DIR = File.dirname(__FILE__) + "/../../template/"
3
+
4
+ def self.template_content(name)
5
+ content = ""
6
+ File.open(File.expand_path(TEMPLATE_BASE_DIR + name + ".erb")) do |f|
7
+ content = f.read
8
+ end
9
+ content
10
+ end
11
+ end
Binary file
@@ -0,0 +1,4 @@
1
+ $(OUTPUT_PATH)/lib$(PROJECT_NAME).a : $(OBJS) $(PROD_OBJS)
2
+ <%= pack_dep_project_commands %>
3
+ $(AR) $(ARFLAGS) $@ $^ <%= dep_projects_output_names %>
4
+ package: init $(OUTPUT_PATH)/lib$(PROJECT_NAME).a
@@ -0,0 +1,6 @@
1
+ $(OUTPUT_PATH)/$(PROJECT_NAME): $(OBJS) $(PROD_OBJS)
2
+ <%= pack_dep_project_commands %>
3
+ $(LINK) -o $(OUTPUT_PATH)/$(PROJECT_NAME) <%= @project.prod_time_lib_path_flag %> ${PROD_OBJS} $(OBJS) <%= @project.prod_time_lib_flag %> <%= dep_projects_output_names %>
4
+ run: init $(OUTPUT_PATH)/$(PROJECT_NAME)
5
+ $(OUTPUT_PATH)/$(PROJECT_NAME)
6
+ package: init $(OUTPUT_PATH)/$(PROJECT_NAME)
@@ -8,22 +8,22 @@ SOURCE_FOLDER_NAME = <%= @source_folder_name %>
8
8
 
9
9
  #--------------------flags-----------------
10
10
  DEPS_FLAG = -MMD -MP -MF"$(@:%.o=%.d)"
11
- CC = <%= @cc %>
12
- LINK = <%= @link %>
11
+ CC = <%= @compile_command_with_flag %>
12
+ LINK = <%= @link_command_with_flag %>
13
13
 
14
14
  #--------------------source files-----------------
15
- SRCS = <%= srcs %>
16
- TEST_SRCS = <%= test_srcs %>
17
- PROD_SRCS = <%= prod_srcs %>
15
+ SRCS = <%= compile_time_srcs %>
16
+ TEST_SRCS = <%= test_time_srcs %>
17
+ PROD_SRCS = <%= prod_time_srcs %>
18
18
 
19
19
  #--------------------folders-----------------
20
20
 
21
21
  FOLDERS = <%= sub_folders_in_target_folder%>
22
22
 
23
23
  #--------------------objs-----------------
24
- OBJS += $(patsubst $(APP_PATH)/$(SOURCE_FOLDER_NAME)/%.cc, $(OUTPUT_PATH)/app/%.o, $(SRCS))
25
- TEST_OBJS += $(patsubst $(TEST_PATH)/$(SOURCE_FOLDER_NAME)/%.cc, $(OUTPUT_PATH)/test/%.o, $(TEST_SRCS))
26
- PROD_OBJS += $(patsubst $(PROD_PATH)/$(SOURCE_FOLDER_NAME)/%.cc, $(OUTPUT_PATH)/prod/%.o, $(PROD_SRCS))
24
+ OBJS += $(patsubst $(APP_PATH)/$(SOURCE_FOLDER_NAME)/%.<%= @src_suffix %>, $(OUTPUT_PATH)/app/%.o, $(SRCS))
25
+ TEST_OBJS += $(patsubst $(TEST_PATH)/$(SOURCE_FOLDER_NAME)/%.<%= @src_suffix %>, $(OUTPUT_PATH)/test/%.o, $(TEST_SRCS))
26
+ PROD_OBJS += $(patsubst $(PROD_PATH)/$(SOURCE_FOLDER_NAME)/%.<%= @src_suffix %>, $(OUTPUT_PATH)/prod/%.o, $(PROD_SRCS))
27
27
 
28
28
  #--------------------deps-----------------
29
29
  DEPS += $(OBJS:.o=.d)
@@ -33,11 +33,11 @@ ALL_DEPS = $(DEPS) $(TEST_DEPS) $(PROD_DEPS)
33
33
 
34
34
  #--------------------compile rules-----------------
35
35
 
36
- $(TEST_OBJS): $(OUTPUT_PATH)/test/%.o: $(TEST_PATH)/$(SOURCE_FOLDER_NAME)/%.cc
36
+ $(TEST_OBJS): $(OUTPUT_PATH)/test/%.o: $(TEST_PATH)/$(SOURCE_FOLDER_NAME)/%.<%= @src_suffix %>
37
37
  $(CC) <%= test_time_search_path_flag %> $(DEPS_FLAG) -c -o "$@" "$<"
38
- $(OBJS): $(OUTPUT_PATH)/app/%.o: $(APP_PATH)/$(SOURCE_FOLDER_NAME)/%.cc
38
+ $(OBJS): $(OUTPUT_PATH)/app/%.o: $(APP_PATH)/$(SOURCE_FOLDER_NAME)/%.<%= @src_suffix %>
39
39
  $(CC) <%= compile_time_search_path_flag %> $(DEPS_FLAG) -c -o "$@" "$<"
40
- $(PROD_OBJS): $(OUTPUT_PATH)/prod/%.o: $(PROD_PATH)/$(SOURCE_FOLDER_NAME)/%.cc
40
+ $(PROD_OBJS): $(OUTPUT_PATH)/prod/%.o: $(PROD_PATH)/$(SOURCE_FOLDER_NAME)/%.<%= @src_suffix %>
41
41
  $(CC) <%= prod_time_search_path_flag %> $(DEPS_FLAG) -c -o "$@" "$<"
42
42
 
43
43
  #--------------------ut-----------------
@@ -45,21 +45,21 @@ $(OUTPUT_PATH)/$(PROJECT_NAME)_ut: $(OBJS) $(TEST_OBJS)
45
45
  $(LINK) -o $(OUTPUT_PATH)/$(PROJECT_NAME)_ut <%= test_time_lib_path_flag %> ${TEST_OBJS} $(OBJS) <%= test_time_lib_flag %>
46
46
  test: init $(OUTPUT_PATH)/$(PROJECT_NAME)_ut
47
47
  $(OUTPUT_PATH)/$(PROJECT_NAME)_ut
48
+ testall: test
49
+ <%= run_test_on_deps %>
48
50
 
49
51
  #--------------------package-----------------
50
- $(OUTPUT_PATH)/$(PROJECT_NAME): $(OBJS) $(PROD_OBJS)
51
- $(LINK) -o $(OUTPUT_PATH)/$(PROJECT_NAME) <%= prod_time_lib_path_flag %> ${PROD_OBJS} $(OBJS) <%= prod_time_lib_flag %>
52
- run: init $(OUTPUT_PATH)/$(PROJECT_NAME)
53
- $(OUTPUT_PATH)/$(PROJECT_NAME)
54
- package: $(OUTPUT_PATH)/$(PROJECT_NAME)
52
+ <%=package_part%>
55
53
 
56
54
  #--------------------misc-----------------
57
55
  $(FOLDERS): %:
58
56
  mkdir -p "$@"
59
57
  init:$(FOLDERS)
60
58
  clean:
61
- rm -rf $(OBJS) $(TEST_OBJS) $(PROD_OBJS) $(ALL_DEPS) $(OUTPUT_PATH)/$(PROJECT_NAME) $(OUTPUT_PATH)/$(PROJECT_NAME)_ut $(FOLDERS)
59
+ rm -rf $(OUTPUT_PATH)/*
60
+ cleanall: clean
61
+ rm -rf <%= dep_projects_output_path%>
62
62
 
63
- .PHONY: clean init
63
+ .PHONY: clean init cleanall
64
64
 
65
65
  -include $(ALL_DEPS)
@@ -0,0 +1,8 @@
1
+ test:
2
+ <%= run_test_on_deps %>
3
+ clean:
4
+ rm -rf <%= dep_projects_output_path%>
5
+ package:
6
+ <%= pack_dep_project_commands %>
7
+
8
+ .PHONY: clean test package
@@ -0,0 +1,2 @@
1
+ package:
2
+ <%= pack_dep_project_commands %>
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple-make
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Cui Liqiang
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2013-12-30 00:00:00.000000000 Z
12
+ date: 2014-01-06 00:00:00.000000000 Z
12
13
  dependencies: []
13
14
  description: A tool to help you create makefile base on a build.sm file.
14
15
  email: cui.liqiang@gmail.com
@@ -17,36 +18,67 @@ executables:
17
18
  extensions: []
18
19
  extra_rdoc_files: []
19
20
  files:
20
- - .gitignore
21
+ - ./.idea/.name
22
+ - ./.idea/codeStyleSettings.xml
23
+ - ./.idea/encodings.xml
24
+ - ./.idea/misc.xml
25
+ - ./.idea/modules.xml
26
+ - ./.idea/scopes/scope_settings.xml
27
+ - ./.idea/simple-make.iml
28
+ - ./.idea/vcs.xml
29
+ - ./.idea/workspace.xml
30
+ - ./.travis.yml
31
+ - ./bin/sm
32
+ - ./Gemfile
33
+ - ./Gemfile.lock
34
+ - ./lib/simple-make/cli.rb
35
+ - ./lib/simple-make/dependency.rb
36
+ - ./lib/simple-make/dependency_project.rb
37
+ - ./lib/simple-make/dir_traverser.rb
38
+ - ./lib/simple-make/normal_makefile_maker.rb
39
+ - ./lib/simple-make/package_type/archive_package.rb
40
+ - ./lib/simple-make/package_type/executable_package.rb
41
+ - ./lib/simple-make/package_type/package.rb
42
+ - ./lib/simple-make/package_type/package_factory.rb
43
+ - ./lib/simple-make/path_helper.rb
44
+ - ./lib/simple-make/project.rb
45
+ - ./lib/simple-make/project_factory.rb
46
+ - ./lib/simple-make/root_makefile_maker.rb
47
+ - ./lib/simple-make/search_path.rb
48
+ - ./lib/simple-make/std_logger.rb
49
+ - ./lib/simple-make/template.rb
50
+ - ./lib/simple-make.rb
51
+ - ./Rakefile
52
+ - ./simple-make-0.0.1.gem
53
+ - ./template/archive_package.erb
54
+ - ./template/executable_package.erb
55
+ - ./template/makefile.erb
56
+ - ./template/root_makefile.erb
57
+ - ./template/root_package.erb
21
58
  - bin/sm
22
- - lib/simple-make.rb
23
- - lib/simple-make/dependency.rb
24
- - lib/simple-make/dir_traverser.rb
25
- - lib/simple-make/project.rb
26
- - lib/simple-make/search_path.rb
27
- - template/makefile.erb
28
59
  homepage: ''
29
60
  licenses:
30
61
  - MIT
31
- metadata: {}
32
62
  post_install_message:
33
63
  rdoc_options: []
34
64
  require_paths:
35
65
  - lib
36
66
  required_ruby_version: !ruby/object:Gem::Requirement
67
+ none: false
37
68
  requirements:
38
- - - '>='
69
+ - - ! '>='
39
70
  - !ruby/object:Gem::Version
40
71
  version: '0'
41
72
  required_rubygems_version: !ruby/object:Gem::Requirement
73
+ none: false
42
74
  requirements:
43
- - - '>='
75
+ - - ! '>='
44
76
  - !ruby/object:Gem::Version
45
77
  version: '0'
46
78
  requirements: []
47
79
  rubyforge_project:
48
- rubygems_version: 2.0.3
80
+ rubygems_version: 1.8.24
49
81
  signing_key:
50
- specification_version: 4
82
+ specification_version: 3
51
83
  summary: convention over configuration c/c++ file build tool
52
84
  test_files: []
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: b6aa846b3416f493a8e42e59338a63e74970ea3d
4
- data.tar.gz: 6cb6ec03baa63adfcfecb0cddd7a1b537cb00767
5
- SHA512:
6
- metadata.gz: fb13206f2c96d93171666e77d25940b4adc1633bd745384378b89adca9cdee6dc4da445c7592036c1dcb1d36d274eb9bdfd078ac60c84268f0e3e001746d16f6
7
- data.tar.gz: 4d58f6d963967b8d6604f74d2b30d0f6ac82b255faa136cb20d5bf8b86d435777b44f72cf16db762bb45a4ccdc6344480d1eb2e0fa2ee7b5e269cb7d37bd86f1
data/.gitignore DELETED
@@ -1,4 +0,0 @@
1
- .idea
2
- *.gem
3
- Makefile
4
- makefile