makefiles: Add a makedep pragma to mark source files that are parts of the import library.

This commit is contained in:
Alexandre Julliard 2013-11-11 11:23:38 +01:00
parent 456c8f435a
commit fe946f253a
4 changed files with 33 additions and 16 deletions

View File

@ -32,16 +32,7 @@ ALLCROSSCFLAGS = $(INCLUDES) $(DEFS) -DWINE_CROSSTEST $(CPPFLAGS) $(CFLAGS)
# Implicit rules
.SUFFIXES: .ok .man.in .man .cross.o .po .mo @MAINTAINER_MODE@ .sfd .ttf .svg .ico .bmp
.c.o:
$(CC) -c $(ALLCFLAGS) -o $@ $<
.m.o:
$(CC) -c $(ALLCFLAGS) -o $@ $<
.c.cross.o:
$(CROSSCC) -c $(INCLUDES) $(DEFS) -DWINE_CROSSTEST $(CPPFLAGS) $(CFLAGS) -o $@ $<
.SUFFIXES: .ok .man.in .man .po .mo @MAINTAINER_MODE@ .sfd .ttf .svg .ico .bmp
.c.ok:
$(RUNTEST) $(RUNTESTFLAGS) $< && touch $@

View File

@ -16,6 +16,10 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#if 0
#pragma makedep implib
#endif
#include <stdarg.h>
#include "windef.h"

View File

@ -335,9 +335,7 @@ sub parse_makefile($)
my $var = $1;
my @list = split(/\s+/, $2);
$make{$var} = \@list;
${$make{"=flags"}}{"mc"} = 1 if $var eq "MC_SRCS";
${$make{"=flags"}}{"staticimplib"} = 1 if $var eq "IMPLIB_SRCS";
${$make{"=flags"}}{"clean"} = 1 if $var =~ /IDL_[CHIPRS]_SRCS|IDL_TLB_SRCS|PROGRAMS/;
${$make{"=flags"}}{"clean"} = 1 if $var eq "PROGRAMS";
next;
}
if (/(install-lib|install-dev|clean)\s*:/)
@ -427,12 +425,20 @@ sub assign_sources_to_makefiles(@)
}
else
{
if ($name =~ /\.c$/) { push @{${$make}{"=C_SRCS"}}, $name; }
elsif ($name =~ /\.m$/) { push @{${$make}{"=OBJC_SRCS"}}, $name; }
if ($name =~ /\.m$/) { push @{${$make}{"=OBJC_SRCS"}}, $name; }
elsif ($name =~ /\.l$/) { push @{${$make}{"=LEX_SRCS"}}, $name; }
elsif ($name =~ /\.y$/) { push @{${$make}{"=BISON_SRCS"}}, $name; }
elsif ($name =~ /\.mc$/) { push @{${$make}{"=MC_SRCS"}}, $name; }
elsif ($name =~ /\.svg$/) { push @{${$make}{"=SVG_SRCS"}}, $name; }
elsif ($name =~ /\.c$/)
{
my %flags = get_makedep_flags( $file );
if (defined $flags{"implib"})
{
push @{${$make}{"=IMPLIB_SRCS"}}, $name;
${${$make}{"=flags"}}{"staticimplib"} = 1;
}
push @{${$make}{"=C_SRCS"}}, $name;
}
elsif ($name =~ /\.rc$/)
{
my %flags = get_makedep_flags( $file );
@ -443,6 +449,11 @@ sub assign_sources_to_makefiles(@)
}
push @{${$make}{"=RC_SRCS"}}, $name;
}
elsif ($name =~ /\.mc$/)
{
push @{${$make}{"=MC_SRCS"}}, $name;
${${$make}{"=flags"}}{"mc"} = 1;
}
elsif ($name =~ /\.idl$/)
{
my %flags = get_makedep_flags( $file );
@ -453,6 +464,7 @@ sub assign_sources_to_makefiles(@)
push @{${$make}{"=IDL_R_SRCS"}}, $name if defined $flags{"register"};
push @{${$make}{"=IDL_S_SRCS"}}, $name if defined $flags{"server"};
push @{${$make}{"=IDL_TLB_SRCS"}}, $name if defined $flags{"typelib"};
${${$make}{"=flags"}}{"clean"} = 1;
}
}
}
@ -567,6 +579,7 @@ sub update_makefiles(@)
replace_makefile_variable( $file, "IDL_S_SRCS" );
replace_makefile_variable( $file, "IDL_TLB_SRCS" );
replace_makefile_variable( $file, "XTEMPLATE_SRCS" );
replace_makefile_variable( $file, "IMPLIB_SRCS" );
replace_makefile_variable( $file, "SRCDIR_INCLUDES" );
}

View File

@ -59,6 +59,7 @@ struct incl_file
#define FLAG_IDL_TYPELIB 0x0040 /* generates a typelib (.tlb) file */
#define FLAG_IDL_HEADER 0x0080 /* generates a header (.h) file */
#define FLAG_RC_PO 0x0100 /* rc file contains translations */
#define FLAG_C_IMPLIB 0x0200 /* file is part of an import library */
static const struct
{
@ -747,6 +748,7 @@ static void parse_pragma_directive( struct incl_file *source, char *str )
{
if (!strcmp( flag, "po" )) source->flags |= FLAG_RC_PO;
}
else if (!strcmp( flag, "implib" )) source->flags |= FLAG_C_IMPLIB;
}
}
@ -1232,8 +1234,15 @@ static void output_sources(void)
else
output( "\t$(CC) -c $(ALLCFLAGS) -o $@ %s\n", source->filename );
}
if (source->flags & FLAG_C_IMPLIB)
{
strarray_add( &clean_files, strmake( "%s.cross.o", obj ));
output( "%s.cross.o: %s\n", obj, source->filename );
output( "\t$(CROSSCC) -c $(ALLCROSSCFLAGS) -o $@ %s\n", source->filename );
}
LIST_FOR_EACH_ENTRY( ext, &object_extensions, struct object_extension, entry )
column += output( "%s.%s ", obj, ext->extension );
if (source->flags & FLAG_C_IMPLIB) column += output( "%s.cross.o", obj );
column += output( ":" );
}
free( obj );