demake 0.1.2 → 0.2.0

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,61 @@
1
+ /*
2
+
3
+ typedefs.h -- Include and typedefs for basic C types
4
+
5
+ These typedefs appear in all full library header files.
6
+
7
+ You can override all of them by including this file first and making your changes here.
8
+
9
+ To add text editor color highlight support for these typedefs see below.
10
+
11
+ */
12
+
13
+ #ifndef TYPEDEFS_H_Minaswan /* Prevents multiple inclusions */
14
+ #define TYPEDEFS_H_Minaswan
15
+ #define TYPEDEFS_VERSION "0.1.0"
16
+ #include <stdint.h>
17
+
18
+ typedef uint8_t b8; /* Booleans */
19
+ typedef uint16_t b16;
20
+ typedef uint32_t b32;
21
+ typedef uint64_t b64;
22
+
23
+ typedef char c8; /* Characters */
24
+ typedef unsigned char uc8;
25
+
26
+ typedef uint8_t u8; /* Unsigned Numbers */
27
+ typedef uint16_t u16;
28
+ typedef uint32_t u32;
29
+ typedef uint64_t u64;
30
+
31
+ typedef int8_t i8; /* Signed Numbers */
32
+ typedef int16_t i16;
33
+ typedef int32_t i32;
34
+ typedef int64_t i64;
35
+
36
+ typedef float f32; /* Floating Point Numbers */
37
+ typedef double f64;
38
+ #endif /* TYPEDEFS_H_Minaswan */
39
+
40
+ /*
41
+
42
+ For nvim, add to ~/.config/nvim/init.lua:
43
+
44
+ vim.cmd("syntax on")
45
+ vim.api.nvim_create_augroup("CustomCTypedefs", { clear = true })
46
+ vim.api.nvim_create_autocmd("FileType", {
47
+ group = "CustomCTypedefs",
48
+ pattern = { "c", "h", "cpp", "hpp" },
49
+ callback = function()
50
+ vim.cmd([[syntax match CustomTypedef /\<\(b8\|b16\|b32\|b64\|c8\|uc8\|i8\|i16\|i32\|i64\|u8\|u16\|u32\|u64\|f32\|f64\)\>/]])
51
+ vim.cmd([[highlight CustomTypedef guifg=green ctermfg=green]])
52
+ end,
53
+ })
54
+
55
+ For nano, add to /usr/share/nano/c.nanorc:
56
+
57
+ color green "\<(b8|b16|b32|b64|c8|uc8|i8|i16|i32|i64|u8|u16|u32|u64|f32|f64)\>"
58
+
59
+ For emacs, it would seem the magic is strong, because it just works. :)
60
+
61
+ */
@@ -0,0 +1,6 @@
1
+ @build_target = <<-END_OF_STRING
2
+ \t@echo "|=[|#{SHORT_WIDTH}-]|O"
3
+ \t@echo "|]#{BOX_WIDTH}|=! #{@emoji_build} Building executable: #{@binary_directory}/|O|g#{app[0]}|n|=|;!|O"
4
+ \t@echo "|={|#{SHORT_WIDTH}-}|O"
5
+ \t@$(MAKE) $(BINARY)/#{app[0]}
6
+ END_OF_STRING
@@ -0,0 +1,6 @@
1
+ @clean_target = <<-END_OF_STRING
2
+ .PHONY : clean
3
+ clean :
4
+ \t@echo "#{@emoji_clean} Removed |Yeverything|n from |R$(OBJECT)|n, |R$(BINARY)|n, and |R$(LIBRARY)|n directories"
5
+ \t@rm -rf $(OBJECT) $(BINARY) $(LIBRARY)
6
+ END_OF_STRING
@@ -0,0 +1,14 @@
1
+ @debug_executable_target = <<-END_OF_STRING
2
+ $(BINARY)/#{app[0]}_debug : BUILD_FLAGS := $(DEBUG_FLAGS) $(CFLAGS) $(LDFLAGS)
3
+
4
+ $(BINARY)/#{app[0]}_debug : #{LICENSE} $(DOL#{counter})
5
+ \t@echo "|=[|#{SHORT_WIDTH}-]|O"
6
+ \t@echo "|]#{BOX_WIDTH}|=! #{@emoji_debug} #{@emoji_link} Linking Files...|O #{@binary_directory}/|Y#{app[0]}_debug|=|n|;!|O"
7
+ \t@echo "|={|#{SHORT_WIDTH}-}|O"
8
+ ifeq '$(OS)' 'Windows_NT'
9
+ \t@test -d $(BINARY) |||| mkdir $(BINARY)
10
+ else
11
+ \t@mkdir -p $(BINARY)
12
+ endif
13
+ \t$(CC) $(BUILD_FLAGS) $(LIBS) -o $(BINARY)/#{app[0]}_debug $(DOL#{counter}) #{@raw_binary_files}
14
+ END_OF_STRING
@@ -0,0 +1,14 @@
1
+ @debug_library_target = <<-END_OF_STRING
2
+ $(LIBRARY)/#{lib[0]}_debug#{@library_extension} : BUILD_FLAGS := $(DEBUG_FLAGS) $(LIB_CFLAGS) $(LIB_LDFLAGS)
3
+
4
+ $(LIBRARY)/#{lib[0]}_debug#{@library_extension} : $(DOL#{counter})
5
+ \t@echo "|=[|#{SHORT_WIDTH}-]|O"
6
+ \t@echo "|]#{BOX_WIDTH}|=! #{@emoji_debug} #{@emoji_link} Linking Files...|O #{@library_directory}/|Y#{lib[0]}_debug#{@library_extension}|=|n|;!|O"
7
+ \t@echo "|={|#{SHORT_WIDTH}-}|O"
8
+ ifeq '$(OS)' 'Windows_NT'
9
+ \t@test -d $(LIBRARY) |||| mkdir $(LIBRARY)
10
+ else
11
+ \t@mkdir -p $(LIBRARY)
12
+ endif
13
+ \t$(CC) $(BUILD_FLAGS) $(DOL#{counter}) #{@raw_binary_files} $(LIB_LDLIBS) -o $(LIBRARY)/#{lib[0]}_debug#{@library_extension}
14
+ END_OF_STRING
@@ -0,0 +1,4 @@
1
+ @debug_target = <<-END_OF_STRING
2
+ .PHONY : debug
3
+ debug : #{LICENSE}
4
+ END_OF_STRING
@@ -0,0 +1,22 @@
1
+ @dependency_targets = <<-END_OF_STRING
2
+ # Dependencies
3
+ $(OBJECT)#{path}#{filename.sub(/\.cp?p?$/, '.o')} : $(SOURCE)#{path}#{filename}#{dependencies}
4
+ \t@echo "|=!|O #{@emoji_compile} Compiling... |Y$(OBJECT)#{path}#{filename.sub(/\.cp?p?$/, '.o')}|n"
5
+ ifeq '$(OS)' 'Windows_NT'
6
+ \t@test -d $(OBJECT)#{path} |||| mkdir $(OBJECT)#{path}
7
+ else
8
+ \t@mkdir -p $(OBJECT)#{path}
9
+ endif
10
+ \t$(CC) $(BUILD_FLAGS) $(LIBS) -c $(SOURCE)#{path}#{filename} -o $(OBJECT)#{path}#{filename.gsub(/\.cp?p?$/, '.o')}
11
+ # Dependencies for debug
12
+ # $(OBJECT)#{path}#{filename.sub(/\.cp?p?$/, '_debug.o')} : BUILD_FLAGS := $(DEBUG_FLAGS) $(CFLAGS)
13
+ #
14
+ $(OBJECT)#{path}#{filename.sub(/\.cp?p?$/, '_debug.o')} : $(SOURCE)#{path}#{filename}#{dependencies}
15
+ \t@echo "|=!|O #{@emoji_debug} #{@emoji_compile} Compiling... |Y$(OBJECT)#{path}#{filename.sub(/\.cp?p?$/, '_debug.o')}|n"
16
+ ifeq '$(OS)' 'Windows_NT'
17
+ \t@test -d $(OBJECT)#{path} |||| mkdir $(OBJECT)#{path}
18
+ else
19
+ \t@mkdir -p $(OBJECT)#{path}
20
+ endif
21
+ \t$(CC) $(BUILD_FLAGS) $(LIBS) -c $(SOURCE)#{path}#{filename} -o $(OBJECT)#{path}#{filename.gsub(/\.cp?p?$/, '_debug.o')}
22
+ END_OF_STRING
@@ -0,0 +1,6 @@
1
+ @executable_debug_target = <<-END_OF_STRING
2
+ \t@echo "|=[|#{SHORT_WIDTH}-]|O"
3
+ \t@echo "|]#{BOX_WIDTH}|=! #{@emoji_debug} #{@emoji_build} |nBuilding executable:|O #{@binary_directory}/|Y#{app[0]}_debug|=|n|;!|O"
4
+ \t@echo "|={|#{SHORT_WIDTH}-}|O"
5
+ \t@$(MAKE) $(BINARY)/#{app[0]}_debug#{@pager}
6
+ END_OF_STRING
@@ -0,0 +1,14 @@
1
+ @executable_target = <<-END_OF_STRING
2
+ $(BINARY)/#{app[0]} : BUILD_FLAGS := $(OFLAGS) $(CFLAGS) $(LDFLAGS)
3
+
4
+ $(BINARY)/#{app[0]} : $(OL#{counter})
5
+ \t@echo "|=[|#{SHORT_WIDTH}-]|O"
6
+ \t@echo "|]#{BOX_WIDTH}|=! #{@emoji_link} Linking Files...|O #{@binary_directory}/|g#{app[0]}|=|n|;!|O"
7
+ \t@echo "|={|#{SHORT_WIDTH}-}|O"
8
+ ifeq '$(OS)' 'Windows_NT'
9
+ \t@test -d $(BINARY) |||| mkdir $(BINARY)
10
+ else
11
+ \t@mkdir -p $(BINARY)
12
+ endif
13
+ \t$(CC) $(BUILD_FLAGS) $(OL#{counter})#{@raw_binary_files} $(LDLIBS) -o $(BINARY)/#{app[0]}
14
+ END_OF_STRING
@@ -0,0 +1,26 @@
1
+ @generic_dependency_targets = <<-END_OF_STRING
2
+ # General Auto-Dependencies
3
+ $(OBJECT)/%.o : $(SOURCE)/%.c
4
+ \t@echo "|=!|O #{@emoji_compile} Compiling... |Y$(@)|n"
5
+ ifeq '$(OS)' 'Windows_NT'
6
+ \t@test -d $(BINARY) |||| mkdir $(BINARY)
7
+ \t@test -d $(OBJECT) |||| mkdir $(OBJECT)
8
+ else
9
+ \t@mkdir -p $(BINARY)
10
+ \t@mkdir -p $(OBJECT)
11
+ endif
12
+ \t$(CC) $(BUILD_FLAGS) $(LIBS) -c $< -o $@
13
+ # General Auto-Dependencies for debug
14
+ # $(OBJECT)/%_debug.o : BUILD_FLAGS := $(DEBUG_FLAGS) $(CFLAGS)
15
+ #
16
+ $(OBJECT)/%_debug.o : $(SOURCE)/%.c
17
+ \t@echo "|=!|O #{@emoji_debug} #{@emoji_compile} Compiling... |Y$(@)|n"
18
+ ifeq '$(OS)' 'Windows_NT'
19
+ \t@test -d $(BINARY) |||| mkdir $(BINARY)
20
+ \t@test -d $(OBJECT) |||| mkdir $(OBJECT)
21
+ else
22
+ \t@mkdir -p $(BINARY)
23
+ \t@mkdir -p $(OBJECT)
24
+ endif
25
+ \t$(CC) $(BUILD_FLAGS) $(LIBS) -c $< -o $@
26
+ END_OF_STRING
@@ -0,0 +1,6 @@
1
+ @library_debug_target = <<-END_OF_STRING
2
+ \t@echo "|=[|#{SHORT_WIDTH}-]|O"
3
+ \t@echo "|]#{BOX_WIDTH}|=! #{@emoji_debug} #{@emoji_build} Building library:|O #{@library_directory}/|Y#{lib[0]}_debug#{@library_extension}|=|n|;!|O"
4
+ \t@echo "|={|#{SHORT_WIDTH}-}|O"
5
+ \t@$(MAKE) $(LIBRARY)/#{lib[0]}_debug#{@library_extension}#{@pager}
6
+ END_OF_STRING
@@ -0,0 +1,6 @@
1
+ @library_target = <<-END_OF_STRING
2
+ \t@echo "|=[|#{SHORT_WIDTH}-]|O"
3
+ \t@echo "|]#{BOX_WIDTH}|=! #{@emoji_build} Building library: #{@library_directory}/|O|g#{lib[0]}|n|=|;!|O"
4
+ \t@echo "|={|#{SHORT_WIDTH}-}|O"
5
+ \t@$(MAKE) $(LIBRARY)/#{lib[0]}#{@library_extension}
6
+ END_OF_STRING
@@ -0,0 +1,10 @@
1
+ @license_target = <<-END_OF_STRING
2
+ .PHONY : license
3
+ license:
4
+ \t@echo "$$LICENSE_FILE" > LICENSE
5
+ \t@echo "$$LICENSE" | less -F -R -X -e
6
+
7
+ LICENSE:
8
+ \t@echo "$$LICENSE_FILE" > LICENSE
9
+ \t@echo "$$LICENSE" | less -R -X -e
10
+ END_OF_STRING
@@ -0,0 +1,14 @@
1
+ @link_library_target = <<-END_OF_STRING
2
+ $(LIBRARY)/#{lib[0]}#{@library_extension} : BUILD_FLAGS := $(OFLAGS) $(LIB_CFLAGS) $(LIB_LDFLAGS)
3
+
4
+ $(LIBRARY)/#{lib[0]}#{@library_extension} : $(OL#{counter})
5
+ \t@echo "|=[|#{SHORT_WIDTH}-]|O"
6
+ \t@echo "|]#{BOX_WIDTH}|=! #{@emoji_link} Linking Files...|O #{@library_directory}/|g#{lib[0]}#{@library_extension}|=|n|;!|O"
7
+ \t@echo "|={|#{SHORT_WIDTH}-}|O"
8
+ ifeq '$(OS)' 'Windows_NT'
9
+ \t@test -d $(LIBRARY) |||| mkdir $(LIBRARY)
10
+ else
11
+ \t@mkdir -p $(LIBRARY)
12
+ endif
13
+ \t$(CC) $(BUILD_FLAGS) $(OL#{counter})#{@raw_binary_files} $(LIB_LDLIBS) -o $(LIBRARY)/#{lib[0]}#{@library_extension}
14
+ END_OF_STRING
@@ -0,0 +1,8 @@
1
+ @strip_build = <<-END_OF_STRING
2
+ \t@if command -v $(STRIP) >/dev/null 2>&1 ; then \
3
+ \t echo "Stripping $(BINARY)/#{app[0]}"; \
4
+ \t $(STRIP) $(STRIP_ARGS) $(BINARY)/#{app[0]} |||| echo "Warning: strip failed for $(BINARY)/#{app[0]}"; \
5
+ \telse \
6
+ \t echo "strip not found; skipping strip step"; \
7
+ \tfi
8
+ END_OF_STRING
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: demake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Minaswan Nakamoto
@@ -55,14 +55,15 @@ description: |
55
55
  > mkdir demake
56
56
  > echo "hello string" > demake/applications
57
57
  > echo "goodbye string" >> demake/applications
58
- > demake > Makefile
58
+ > demake
59
59
 
60
60
  For customization, optionally include (see example):
61
- demake/settings.rb, demake/test-target.rb, demake/install-target.rb
61
+ demake/settings.rb, demake/test-target.rb, demake/install-target.rb,
62
+ demake/license
62
63
 
63
- The output of the command by itself is a (GNU style) Makefile:
64
+ The output of the command by itself is a (GNU style) file named Makefile:
64
65
 
65
- > demake > Makefile
66
+ > demake
66
67
 
67
68
  You can also clone from git for a more complete example:
68
69
 
@@ -83,6 +84,37 @@ extensions: []
83
84
  extra_rdoc_files: []
84
85
  files:
85
86
  - bin/demake
87
+ - lib/data/example/demake/applications
88
+ - lib/data/example/demake/license
89
+ - lib/data/example/demake/settings.rb
90
+ - lib/data/example/demake/test-target.rb
91
+ - lib/data/example/src/goodbye.c
92
+ - lib/data/example/src/hello.c
93
+ - lib/data/example/src/string/string.c
94
+ - lib/data/example/src/string/string.h
95
+ - lib/data/oreo/demake/applications
96
+ - lib/data/oreo/demake/license
97
+ - lib/data/oreo/demake/settings.rb
98
+ - lib/data/oreo/demake/test-target.rb
99
+ - lib/data/oreo/oreo_test.txt
100
+ - lib/data/oreo/src/defines.h
101
+ - lib/data/oreo/src/fast_read_file.h
102
+ - lib/data/oreo/src/oreo.c
103
+ - lib/data/oreo/src/typedefs.h
104
+ - lib/template/build_target.rb
105
+ - lib/template/clean_target.rb
106
+ - lib/template/debug_executable_target.rb
107
+ - lib/template/debug_library_target.rb
108
+ - lib/template/debug_target.rb
109
+ - lib/template/dependency_targets.rb
110
+ - lib/template/executable_debug_target.rb
111
+ - lib/template/executable_target.rb
112
+ - lib/template/generic_dependency_targets.rb
113
+ - lib/template/library_debug_target.rb
114
+ - lib/template/library_target.rb
115
+ - lib/template/license_target.rb
116
+ - lib/template/link_library_target.rb
117
+ - lib/template/strip_build.rb
86
118
  homepage: https://github.com/MinaswanNakamoto/demake
87
119
  licenses:
88
120
  - MIT