makefiles: Generate rules for installing headers.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2015-11-02 15:53:42 +09:00
parent e5d4d91871
commit 4323384975
3 changed files with 104 additions and 56 deletions

View File

@ -154,15 +154,8 @@ PUBLIC_IDL_H_SRCS = \
IDL_TLB_SRCS = \
stdole2.idl
XTEMPLATE_SRCS = \
rmxftmpl.x
SRCDIR_INCLUDES = \
$(IDL_TLB_SRCS) \
$(PUBLIC_IDL_H_SRCS) \
$(XTEMPLATE_SRCS) \
HEADER_SRCS = \
accctrl.h \
access.idl \
aclapi.h \
aclui.h \
adshlp.h \
@ -171,8 +164,6 @@ SRCDIR_INCLUDES = \
amaudio.h \
appcompatapi.h \
appmgmt.h \
asynot.idl \
asysta.idl \
atlbase.h \
atlcom.h \
atlwin.h \
@ -180,23 +171,17 @@ SRCDIR_INCLUDES = \
audiosessiontypes.h \
aviriff.h \
avrt.h \
axcore.idl \
axextend.idl \
basetsd.h \
basetyps.h \
bcrypt.h \
bdaiface_enums.h \
bdatypes.h \
binres.idl \
bitsmsg.h \
cderr.h \
cfgmgr32.h \
cguid.h \
chprst.idl \
cierror.h \
clusapi.h \
cmdbas.idl \
cmdtxt.idl \
commctrl.h \
commctrl.rh \
commdlg.h \
@ -204,7 +189,6 @@ SRCDIR_INCLUDES = \
corerror.h \
corhdr.h \
cpl.h \
crtrow.idl \
cryptdlg.h \
cryptuiapi.h \
custcntl.h \
@ -244,13 +228,7 @@ SRCDIR_INCLUDES = \
d3dx9tex.h \
d3dx9xof.h \
davclnt.h \
dbccmd.idl \
dbcses.idl \
dbdsad.idl \
dbghelp.h \
dbinit.idl \
dbprop.idl \
dbs.idl \
dbt.h \
dciddi.h \
dciman.h \
@ -285,7 +263,6 @@ SRCDIR_INCLUDES = \
ddrawgdi.h \
ddrawi.h \
delayloadhandler.h \
devenum.idl \
devguid.h \
devpkey.h \
devpropdef.h \
@ -329,10 +306,8 @@ SRCDIR_INCLUDES = \
dxfile.h \
dxgiformat.h \
dxgitype.h \
dyngraph.idl \
errorrep.h \
errors.h \
errrec.idl \
evcode.h \
evntprov.h \
evntrace.h \
@ -506,7 +481,6 @@ SRCDIR_INCLUDES = \
olectl.h \
oledberr.h \
oledlg.h \
opnrst.idl \
patchapi.h \
pdh.h \
pdhmsg.h \
@ -534,10 +508,6 @@ SRCDIR_INCLUDES = \
richedit.h \
rmxfguid.h \
roapi.h \
row.idl \
rowchg.idl \
rowpos.idl \
rowpsc.idl \
rpc.h \
rpcasync.h \
rpcdce.h \
@ -546,10 +516,6 @@ SRCDIR_INCLUDES = \
rpcnterr.h \
rpcproxy.h \
rpcsal.h \
rstbas.idl \
rstinf.idl \
rstloc.idl \
rstnot.idl \
rtutils.h \
scarderr.h \
schannel.h \
@ -559,7 +525,6 @@ SRCDIR_INCLUDES = \
secext.h \
security.h \
sensapi.h \
sesprp.idl \
setupapi.h \
sfc.h \
shdispid.h \
@ -575,7 +540,6 @@ SRCDIR_INCLUDES = \
sql.h \
sqlext.h \
sqltypes.h \
srcrst.idl \
srrestoreptapi.h \
sspi.h \
sti.h \
@ -604,7 +568,6 @@ SRCDIR_INCLUDES = \
verrsrc.h \
vfw.h \
vfwmsgs.h \
vmrender.idl \
vsstyle.h \
vssym32.h \
vswriter.h \
@ -674,12 +637,51 @@ SRCDIR_INCLUDES = \
xcmc.h \
xinput.h \
xmldom.h \
xmldom.idl \
xmldomdid.h \
xmldso.idl \
xmldsodid.h \
zmouse.h
XTEMPLATE_SRCS = \
rmxftmpl.x
SRCDIR_INCLUDES = \
$(IDL_TLB_SRCS) \
$(PUBLIC_IDL_H_SRCS) \
$(XTEMPLATE_SRCS) \
access.idl \
asynot.idl \
asysta.idl \
axcore.idl \
axextend.idl \
binres.idl \
chprst.idl \
cmdbas.idl \
cmdtxt.idl \
crtrow.idl \
dbccmd.idl \
dbcses.idl \
dbdsad.idl \
dbinit.idl \
dbprop.idl \
dbs.idl \
devenum.idl \
dyngraph.idl \
errrec.idl \
opnrst.idl \
row.idl \
rowchg.idl \
rowpos.idl \
rowpsc.idl \
rstbas.idl \
rstinf.idl \
rstloc.idl \
rstnot.idl \
sesprp.idl \
srcrst.idl \
vmrender.idl \
xmldom.idl \
xmldso.idl
IDL_H_SRCS = $(PUBLIC_IDL_H_SRCS) $(PRIVATE_IDL_H_SRCS)
IDL_SRCS = $(IDL_H_SRCS) $(IDL_TLB_SRCS)

View File

@ -378,10 +378,10 @@ sub assign_sources_to_makefiles(@)
}
if ($name =~ /stdole2\.idl$/) { push @{${$make}{"=IDL_TLB_SRCS"}}, $name; }
elsif ($private_idl_headers{$name}) { push @{${$make}{"=SRCDIR_INCLUDES"}}, $name; }
elsif ($name =~ /\.h$/) { push @{${$make}{"=SRCDIR_INCLUDES"}}, $name; }
elsif ($name =~ /\.h$/) { push @{${$make}{"=HEADER_SRCS"}}, $name; }
elsif ($name =~ /\.x$/) { push @{${$make}{"=XTEMPLATE_SRCS"}}, $name; }
elsif ($name =~ /\.rh$/) { push @{${$make}{"=SRCDIR_INCLUDES"}}, $name; }
elsif ($name =~ /\.inl$/) { push @{${$make}{"=SRCDIR_INCLUDES"}}, $name; }
elsif ($name =~ /\.rh$/) { push @{${$make}{"=HEADER_SRCS"}}, $name; }
elsif ($name =~ /\.inl$/) { push @{${$make}{"=HEADER_SRCS"}}, $name; }
elsif ($name =~ /\.idl$/) { push @{${$make}{"=PUBLIC_IDL_H_SRCS"}}, $name; }
else { die "unknown file $name in include dir"; }
}
@ -549,6 +549,7 @@ sub update_makefiles(@)
replace_makefile_variable( $file, "OBJC_SRCS" );
replace_makefile_variable( $file, "RC_SRCS" );
replace_makefile_variable( $file, "IDL_SRCS" );
replace_makefile_variable( $file, "HEADER_SRCS" );
replace_makefile_variable( $file, "XTEMPLATE_SRCS" );
replace_makefile_variable( $file, "IN_SRCS" );
replace_makefile_variable( $file, "IMPLIB_SRCS" );

View File

@ -1121,6 +1121,26 @@ static void parse_sfd_file( struct file *source, FILE *file )
}
static const struct
{
const char *ext;
void (*parse)( struct file *file, FILE *f );
} parse_functions[] =
{
{ ".c", parse_c_file },
{ ".h", parse_c_file },
{ ".inl", parse_c_file },
{ ".l", parse_c_file },
{ ".m", parse_c_file },
{ ".rh", parse_c_file },
{ ".x", parse_c_file },
{ ".y", parse_c_file },
{ ".idl", parse_idl_file },
{ ".rc", parse_rc_file },
{ ".in", parse_in_file },
{ ".sfd", parse_sfd_file }
};
/*******************************************************************
* load_file
*/
@ -1128,7 +1148,7 @@ static struct file *load_file( const char *name )
{
struct file *file;
FILE *f;
unsigned int hash = hash_filename( name );
unsigned int i, hash = hash_filename( name );
LIST_FOR_EACH_ENTRY( file, &files[hash], struct file, entry )
if (!strcmp( name, file->name )) return file;
@ -1139,15 +1159,12 @@ static struct file *load_file( const char *name )
input_file_name = file->name;
input_line = 0;
if (strendswith( name, ".idl" )) parse_idl_file( file, f );
else if (strendswith( name, ".rc" )) parse_rc_file( file, f );
else if (strendswith( name, ".in" )) parse_in_file( file, f );
else if (strendswith( name, ".sfd" )) parse_sfd_file( file, f );
else if (strendswith( name, ".c" ) ||
strendswith( name, ".m" ) ||
strendswith( name, ".h" ) ||
strendswith( name, ".l" ) ||
strendswith( name, ".y" )) parse_c_file( file, f );
for (i = 0; i < sizeof(parse_functions) / sizeof(parse_functions[0]); i++)
{
if (!strendswith( name, parse_functions[i].ext )) continue;
parse_functions[i].parse( file, f );
break;
}
fclose( f );
input_file_name = NULL;
@ -1780,6 +1797,19 @@ static void add_install_rule( struct makefile *make, const char *target,
}
/*******************************************************************
* get_include_install_path
*
* Determine the installation path for a given include file.
*/
static const char *get_include_install_path( const char *name )
{
if (!strncmp( name, "wine/", 5 )) return name + 5;
if (!strncmp( name, "msvcrt/", 7 )) return name;
return strmake( "windows/%s", name );
}
/*******************************************************************
* output_install_rules
*
@ -2033,9 +2063,9 @@ static struct strarray output_sources( struct makefile *make, struct strarray *t
else dir = strmake( "$(mandir)/man%s", section );
add_install_rule( make, dest, xstrdup(obj), strmake( "d%s/%s.%s", dir, dest, section ));
symlinks = get_expanded_make_var_array( make, file_local_var( dest, "SYMLINKS" ));
for (j = 0; j < symlinks.count; j++)
add_install_rule( make, symlinks.str[j], strmake( "%s.%s", dest, section ),
strmake( "y%s/%s.%s", dir, symlinks.str[j], section ));
for (i = 0; i < symlinks.count; i++)
add_install_rule( make, symlinks.str[i], strmake( "%s.%s", dest, section ),
strmake( "y%s/%s.%s", dir, symlinks.str[i], section ));
free( dest );
free( dir );
strarray_add( &all_targets, xstrdup(obj) );
@ -2095,6 +2125,20 @@ static struct strarray output_sources( struct makefile *make, struct strarray *t
strarray_add( &res_files, source->name );
continue; /* no dependencies */
}
else if (!strcmp( ext, "h" ) || !strcmp( ext, "rh" ) || !strcmp( ext, "inl" )) /* header file */
{
if (source->file->flags & FLAG_GENERATED)
{
strarray_add( &all_targets, source->name );
}
else
{
strarray_add( &make->install_dev_rules, source->name );
strarray_add( &make->install_dev_rules,
strmake( "D$(includedir)/%s", get_include_install_path( source->name ) ));
}
continue; /* no dependencies */
}
else
{
int need_cross = make->testdll ||
@ -2788,6 +2832,7 @@ static void update_makefile( const char *path )
"IDL_SRCS",
"BISON_SRCS",
"LEX_SRCS",
"HEADER_SRCS",
"XTEMPLATE_SRCS",
"SVG_SRCS",
"FONT_SRCS",