Skip to content

Commit

Permalink
fix(configure): fix the module dependency algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
Water-Melon committed Jan 24, 2024
1 parent edc797c commit dea8eee
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 22 deletions.
56 changes: 35 additions & 21 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -384,33 +384,47 @@ get_source_files() {
files+=$f" "
done
else
old_ifs=$IFS
IFS=','
for f in $select_files
while true
do
IFS=$old_ifs
fname='mln_'$f'.c'
fname=`find src -name $fname`
if [ -z $fname ]; then
echo "[$f] not found"
exit 1
fi
files+=$fname" "
for header in `cpp -MM -MG $fname 2> /dev/null`
old_ifs=$IFS
IFS=','
current_files=$select_files
for f in $select_files
do
suffix=`echo $header | cut -d '.' -f 2`
if [ $suffix == 'h' ]; then
source_file=`echo $header | cut -d '.' -f 1`'.c'
source_file=`find src -name $source_file`
if [ ! -z $source_file ]; then
if [[ ! "${files[@]}" =~ $source_file ]]; then
files+=$source_file" "
IFS=$old_ifs
fname='mln_'$f'.c'
fname=`find src -name $fname`
if [ -z $fname ]; then
echo "[$f] not found"
exit 1
fi
if [[ ! "${files[@]}" =~ $fname ]]; then
files+=$fname" "
fi
for header in `cpp -MM -MG -I include $fname 2> /dev/null`
do
suffix=`echo $header | cut -d '.' -f 2`
if [ $suffix == 'h' ]; then
source_file=`echo $header | cut -d '/' -f 2`
module_name=`echo $source_file | cut -d '.' -f 1`
source_file='src/'$module_name'.c'
module_name=$(echo "$module_name" | sed 's/mln_//')
source_file=`find src -wholename "$source_file"`
if [ ! -z $source_file ]; then
if [[ ! "${files[@]}" =~ $source_file ]]; then
files+=$source_file" "
current_files+=","$module_name
fi
fi
fi
fi
done
done
if [ $select_files = $current_files ]; then
break
fi
select_files=$current_files
IFS=$old_ifs
done
IFS=$old_ifs
fi
select_files=$files
}
Expand Down
1 change: 0 additions & 1 deletion include/mln_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#include <unistd.h>
#include "mln_utils.h"
#include "mln_path.h"
#if defined(__GNUC__) && (__GNUC__ >= 4 && __GNUC_MINOR__ > 1)
typedef long mln_spin_t;
#elif defined(i386) || defined(__x86_64)
Expand Down
1 change: 1 addition & 0 deletions src/mln_conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "mln_conf.h"
#include "mln_log.h"
#include "mln_ipc.h"
#include "mln_path.h"
#include <stdlib.h>

#define CONF_ERR(lex,TK,MSG); \
Expand Down
1 change: 1 addition & 0 deletions src/mln_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

#include "mln_file.h"
#include "mln_path.h"
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
Expand Down
1 change: 1 addition & 0 deletions src/mln_lang.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "mln_lang_real.h"
#include "mln_lang_str.h"
#include "mln_lang_array.h"
#include "mln_path.h"
#if defined(WIN32)
#include <libloaderapi.h>
#else
Expand Down
1 change: 1 addition & 0 deletions src/mln_lang_ast.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <fcntl.h>
#include "mln_lang_ast.h"
#include "mln_parser_generator.h"
#include "mln_path.h"

MLN_DECLARE_PARSER_GENERATOR(static, \
mln_lang, \
Expand Down
1 change: 1 addition & 0 deletions src/mln_lex.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <ctype.h>
#include "mln_string.h"
#include "mln_lex.h"
#include "mln_path.h"

/*
* error information
Expand Down
1 change: 1 addition & 0 deletions src/mln_tools.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "mln_global.h"
#include "mln_conf.h"
#include "mln_log.h"
#include "mln_path.h"

static int
mln_boot_help(const char *boot_str, const char *alias);
Expand Down

0 comments on commit dea8eee

Please sign in to comment.