Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
e8b99155
Commit
e8b99155
authored
Nov 23, 2012
by
Daniel Bovensiepen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change build process to create meaningful Archive file instead of gem.a
parent
e162f6d2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
11 deletions
+46
-11
mrbgems/Makefile4gem
mrbgems/Makefile4gem
+8
-6
mrbgems/generator.c
mrbgems/generator.c
+38
-5
No files found.
mrbgems/Makefile4gem
View file @
e8b99155
...
...
@@ -24,6 +24,8 @@ ifeq ($(strip $(LIBR)),)
LIBR := $(MRUBY_ROOT)lib/libmruby.a
endif
GEM_PACKAGE := mrb-$(GEM)-gem.a
# Default rules which are calling the
# gem specific gem-all and gem-clean
# implementations of a gem
...
...
@@ -36,7 +38,7 @@ gem-info:
# Building target for C and Ruby files
gem-c-and-rb-files : gem_mixlib.o
$(AR) rs
gem.a
$(GEM_OBJECTS) $^
$(AR) rs
$(GEM_PACKAGE)
$(GEM_OBJECTS) $^
gem_mixlib.c : gem_mrblib_header.ctmp gem_mrblib_irep.ctmp gem_mixlib_init.ctmp
cat $^ > $@
...
...
@@ -46,14 +48,14 @@ gem_mixlib_init.ctmp :
# Building target for C files
gem-c-files : gem_srclib.o
$(AR) rs
gem.a
$(GEM_OBJECTS) $<
$(AR) rs
$(GEM_PACKAGE)
$(GEM_OBJECTS) $<
gem_srclib.c :
$(MRUBY_ROOT)mrbgems/generator gem_srclib $(GEM) > $@
# Building target for Ruby Files
gem-rb-files : gem_mrblib.o
$(AR) rs
gem.a
$<
$(AR) rs
$(GEM_PACKAGE)
$<
gem_mrblib.c : gem_mrblib_header.ctmp gem_mrblib_irep.ctmp gem_mrblib_init.ctmp
cat $^ > $@
...
...
@@ -71,13 +73,13 @@ gem_mrblib.rbtmp :
cat $(GEM_RB_FILES) > $@
gem-clean-c-and-rb-files :
-$(RM)
gem.a
gem_mixlib.o gem_mixlib.c gem_mrblib_header.ctmp gem_mrblib_irep.ctmp gem_mixlib_init.ctmp gem_mrblib.rbtmp
-$(RM)
$(GEM_PACKAGE)
gem_mixlib.o gem_mixlib.c gem_mrblib_header.ctmp gem_mrblib_irep.ctmp gem_mixlib_init.ctmp gem_mrblib.rbtmp
gem-clean-c-files :
-$(RM)
gem.a
gem_srclib.c gem_srclib.o $(GEM_OBJECTS)
-$(RM)
$(GEM_PACKAGE)
gem_srclib.c gem_srclib.o $(GEM_OBJECTS)
gem-clean-rb-files :
-$(RM)
gem.a
gem_mrblib.o gem_mrblib.c gem_mrblib_header.ctmp gem_mrblib_init.ctmp gem_mrblib_irep.ctmp gem_mrblib.rbtmp
-$(RM)
$(GEM_PACKAGE)
gem_mrblib.o gem_mrblib.c gem_mrblib_header.ctmp gem_mrblib_init.ctmp gem_mrblib_irep.ctmp gem_mrblib.rbtmp
.PHONY : clean
clean : gem-clean
...
...
mrbgems/generator.c
View file @
e8b99155
...
...
@@ -13,6 +13,39 @@ char *get_file_name(char *path)
return
base
?
base
+
1
:
path
;
}
char
*
replace
(
const
char
*
s
,
const
char
*
old
,
const
char
*
new
)
{
char
*
ret
;
int
i
,
count
=
0
;
size_t
newlen
=
strlen
(
new
);
size_t
oldlen
=
strlen
(
old
);
for
(
i
=
0
;
s
[
i
]
!=
'\0'
;
i
++
)
{
if
(
strstr
(
&
s
[
i
],
old
)
==
&
s
[
i
])
{
count
++
;
i
+=
oldlen
-
1
;
}
}
ret
=
malloc
(
i
+
count
*
(
newlen
-
oldlen
));
if
(
ret
==
NULL
)
exit
(
EXIT_FAILURE
);
i
=
0
;
while
(
*
s
)
{
if
(
strstr
(
s
,
old
)
==
s
)
{
strcpy
(
&
ret
[
i
],
new
);
i
+=
newlen
;
s
+=
oldlen
;
}
else
ret
[
i
++
]
=
*
s
++
;
}
ret
[
i
]
=
'\0'
;
return
ret
;
}
/*
* Template generator for each active GEM
*
...
...
@@ -25,8 +58,8 @@ char *get_file_name(char *path)
* String at the start of the template
* end:
* String at the end of the template
*
dir_to_skip:
*
Name of a directory which will be skipped
*
full_path
*
Should the full path of the GEM be used?
*
*/
static
char
*
...
...
@@ -76,7 +109,7 @@ for_each_gem (char before[1024], char after[1024],
strcat
(
complete_line
,
gem_list
[
i
]);
else
strcat
(
complete_line
,
get_file_name
(
gem_list
[
i
]));
strcat
(
complete_line
,
after
);
strcat
(
complete_line
,
replace
(
after
,
"#GEMNAME#"
,
get_file_name
(
gem_list
[
i
]))
);
}
strcat
(
complete_line
,
end
);
...
...
@@ -161,10 +194,10 @@ void
make_gem_makefile_list
()
{
printf
(
"%s"
,
for_each_gem
(
" "
,
""
,
"GEM_LIST := "
,
"
\n
"
,
TRUE
)
for_each_gem
(
" "
,
"
/mrb-#GEMNAME#-gem.a
"
,
"GEM_LIST := "
,
"
\n
"
,
TRUE
)
);
printf
(
"GEM_ARCHIVE_FILES := $(
addsuffix /gem.a, $(GEM_LIST)
)
\n
"
printf
(
"GEM_ARCHIVE_FILES := $(
GEM_LIST
)
\n
"
"GEM_ARCHIVE_FILES += $(MRUBY_ROOT)/mrbgems/gem_init.a
\n\n
"
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment