Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
517d274e
Commit
517d274e
authored
Nov 12, 2013
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
makefiles: Add support for building from source files from a parent directory.
parent
eaef76f0
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
72 additions
and
3 deletions
+72
-3
Make.rules.in
Make.rules.in
+2
-2
make_makefiles
tools/make_makefiles
+44
-1
makedep.c
tools/makedep.c
+26
-0
No files found.
Make.rules.in
View file @
517d274e
...
...
@@ -11,7 +11,7 @@
# First some useful definitions
INCLUDES = -I$(srcdir) -I. -I$(top_srcdir)/include -I$(top_builddir)/include $(EXTRAINCL)
INCLUDES = -I$(srcdir)
$(PARENTSRC:%=-I@srcdir@/%)
-I. -I$(top_srcdir)/include -I$(top_builddir)/include $(EXTRAINCL)
DEFS = -D__WINESRC__ $(EXTRADEFS)
ALLCFLAGS = $(INCLUDES) $(DEFS) $(DLLFLAGS) $(EXTRACFLAGS) $(CPPFLAGS) $(CFLAGS) $(MODCFLAGS)
IDLFLAGS = $(INCLUDES) $(DEFS) $(EXTRAIDLFLAGS)
...
...
@@ -88,7 +88,7 @@ DEPEND_SRCS = $(C_SRCS) $(OBJC_SRCS) $(RC_SRCS) $(MC_SRCS) \
$(BISON_SRCS) $(LEX_SRCS) $(EXTRA_OBJS)
depend: dummy
$(MAKEDEP) $(MAKEDEPFLAGS) -C$(srcdir) -S$(top_srcdir) -T$(top_builddir) $(EXTRAINCL) $(DEPEND_SRCS)
$(MAKEDEP) $(MAKEDEPFLAGS) -C$(srcdir) -S$(top_srcdir) -T$(top_builddir) $(
PARENTSRC:%=-P%) $(
EXTRAINCL) $(DEPEND_SRCS)
.PHONY: depend
...
...
tools/make_makefiles
View file @
517d274e
...
...
@@ -322,7 +322,7 @@ sub parse_makefile($)
$make
{
"=rules"
}
=
$makerules
{
$var
}
||
$var
;
next
;
}
if
(
/^\s*(MODULE|IMPORTLIB|TESTDLL|MANPAGE)\s*=\s*(.*)/
)
if
(
/^\s*(MODULE|IMPORTLIB|TESTDLL|MANPAGE
|PARENTSRC
)\s*=\s*(.*)/
)
{
my
$var
=
$1
;
$make
{
$var
}
=
$2
;
...
...
@@ -386,6 +386,38 @@ sub get_makedep_flags($)
return
%
flags
;
}
sub
get_parent_makefile
($)
{
my
$file
=
shift
;
my
%
make
=
%
{
$makefiles
{
$file
}};
my
$reldir
=
$make
{
"PARENTSRC"
}
||
""
;
return
""
unless
$reldir
;
(
my
$path
=
$file
)
=~
s/\/Makefile$/\//
;
while
(
$reldir
=~
/^\.\.\//
)
{
$reldir
=~
s/^\.\.\///
;
$path
=~
s/[^\/]+\/$//
;
}
return
"$path$reldir/Makefile"
;
}
# preserve shared source files that are listed in the existing makefile
sub
preserve_shared_source_files
($$$)
{
my
(
$make
,
$parent
,
$var
)
=
@_
;
my
%
srcs
;
return
unless
defined
$
{
$parent
}{
"=$var"
};
foreach
my
$file
(
@
{
$
{
$parent
}{
"=$var"
}})
{
$srcs
{
$file
}
=
1
;
}
foreach
my
$file
(
@
{
$
{
$make
}{
"=$var"
}})
{
$srcs
{
$file
}
=
0
;
}
foreach
my
$file
(
@
{
$
{
$make
}{
$var
}})
{
next
unless
defined
$srcs
{
$file
}
&&
$srcs
{
$file
}
==
1
;
push
@
{
$
{
$make
}{
"=$var"
}},
$file
;
}
}
# assign source files to their respective makefile
sub
assign_sources_to_makefiles
(@)
{
...
...
@@ -474,6 +506,17 @@ sub assign_sources_to_makefiles(@)
unshift
@
{
$
{
$make
}{
"=SRCDIR_INCLUDES"
}},
"\$(XTEMPLATE_SRCS)"
;
unshift
@
{
$
{
$make
}{
"=SRCDIR_INCLUDES"
}},
"\$(PUBLIC_IDL_H_SRCS)"
;
unshift
@
{
$
{
$make
}{
"=SRCDIR_INCLUDES"
}},
"\$(IDL_TLB_SRCS)"
;
# preserve shared source files from the parent makefile
foreach
my
$file
(
@makefiles
)
{
my
%
make
=
%
{
$makefiles
{
$file
}};
my
$parent
=
get_parent_makefile
(
$file
);
next
unless
$parent
;
preserve_shared_source_files
(
$makefiles
{
$file
},
$makefiles
{
$parent
},
"C_SRCS"
);
preserve_shared_source_files
(
$makefiles
{
$file
},
$makefiles
{
$parent
},
"LEX_SRCS"
);
preserve_shared_source_files
(
$makefiles
{
$file
},
$makefiles
{
$parent
},
"BISON_SRCS"
);
}
}
################################################################
...
...
tools/makedep.c
View file @
517d274e
...
...
@@ -107,6 +107,7 @@ struct strarray
static
const
char
*
src_dir
;
static
const
char
*
top_src_dir
;
static
const
char
*
top_obj_dir
;
static
const
char
*
parent_dir
;
static
const
char
*
OutputFileName
=
"Makefile"
;
static
const
char
*
Separator
=
"### Dependencies"
;
static
const
char
*
input_file_name
;
...
...
@@ -121,6 +122,7 @@ static const char Usage[] =
" -Cdir Search for source files in directory 'dir'
\n
"
" -Sdir Set the top source directory
\n
"
" -Tdir Set the top object directory
\n
"
" -Pdir Set the parent source directory
\n
"
" -R from to Compute the relative path between two directories
\n
"
" -fxxx Store output in file 'xxx' (default: Makefile)
\n
"
" -sxxx Use 'xxx' as separator (default:
\"
### Dependencies
\"
)
\n
"
;
...
...
@@ -536,6 +538,16 @@ static FILE *open_src_file( struct incl_file *pFile )
pFile
->
filename
=
strmake
(
"%s/%s"
,
src_dir
,
pFile
->
name
);
file
=
fopen
(
pFile
->
filename
,
"r"
);
}
/* now try parent dir */
if
(
!
file
&&
parent_dir
)
{
if
(
src_dir
)
pFile
->
filename
=
strmake
(
"%s/%s/%s"
,
src_dir
,
parent_dir
,
pFile
->
name
);
else
pFile
->
filename
=
strmake
(
"%s/%s"
,
parent_dir
,
pFile
->
name
);
if
((
file
=
fopen
(
pFile
->
filename
,
"r"
)))
return
file
;
file
=
fopen
(
pFile
->
filename
,
"r"
);
}
if
(
!
file
)
fatal_perror
(
"open %s"
,
pFile
->
name
);
return
file
;
}
...
...
@@ -601,6 +613,17 @@ static FILE *open_include_file( struct incl_file *pFile )
free
(
filename
);
}
/* now try in parent source dir */
if
(
parent_dir
)
{
if
(
src_dir
)
filename
=
strmake
(
"%s/%s/%s"
,
src_dir
,
parent_dir
,
pFile
->
name
);
else
filename
=
strmake
(
"%s/%s"
,
parent_dir
,
pFile
->
name
);
if
((
file
=
fopen
(
filename
,
"r"
)))
goto
found
;
free
(
filename
);
}
/* check for corresponding idl file in global includes */
if
(
strendswith
(
pFile
->
name
,
".h"
))
...
...
@@ -1410,6 +1433,9 @@ static void parse_option( const char *opt )
case
'T'
:
top_obj_dir
=
opt
+
2
;
break
;
case
'P'
:
parent_dir
=
opt
+
2
;
break
;
case
'f'
:
if
(
opt
[
2
])
OutputFileName
=
opt
+
2
;
break
;
...
...
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