mirror of
https://github.com/reactos/wine.git
synced 2025-02-05 11:40:06 +00:00
makefiles: Generate explicit build rules for resource files from makedep.
This commit is contained in:
parent
da4c49c744
commit
25b0810655
@ -36,7 +36,7 @@ CROSSOBJS = $(OBJS:.o=.cross.o)
|
||||
|
||||
# Implicit rules
|
||||
|
||||
.SUFFIXES: .rc .res .idl .tlb .h .ok .man.in .man _c.c _i.c _p.c _s.c _r.res _t.res .cross.o .po .mo @MAINTAINER_MODE@ .sfd .ttf .svg .ico .bmp
|
||||
.SUFFIXES: .idl .tlb .h .ok .man.in .man _c.c _i.c _p.c _s.c _r.res _t.res .cross.o .po .mo @MAINTAINER_MODE@ .sfd .ttf .svg .ico .bmp
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(ALLCFLAGS) -o $@ $<
|
||||
@ -47,9 +47,6 @@ CROSSOBJS = $(OBJS:.o=.cross.o)
|
||||
.c.cross.o:
|
||||
$(CROSSCC) -c $(INCLUDES) $(DEFS) -DWINE_CROSSTEST $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||
|
||||
.rc.res:
|
||||
$(WRC) $(RCFLAGS) -o $@ $<
|
||||
|
||||
.idl.h:
|
||||
$(WIDL) $(IDLFLAGS) -h -o $@ $<
|
||||
|
||||
@ -131,7 +128,7 @@ $(IMPORTLIB:%=lib%.cross.a): $(MAINSPEC) $(IMPLIB_SRCS:.c=.cross.o)
|
||||
|
||||
# Rules for dependencies
|
||||
|
||||
DEPEND_SRCS = $(C_SRCS) $(OBJC_SRCS) $(RC_SRCS) $(MC_SRCS) \
|
||||
DEPEND_SRCS = $(C_SRCS) $(OBJC_SRCS) $(RC_SRCS) $(MC_SRCS) $(PO_SRCS:.rc=.pot) \
|
||||
$(IDL_H_SRCS) $(IDL_C_SRCS) $(IDL_I_SRCS) $(IDL_P_SRCS) $(IDL_S_SRCS) \
|
||||
$(IDL_GEN_C_SRCS) $(IDL_R_SRCS:.idl=_r.res) $(IDL_TLB_SRCS) $(IDL_TLB_SRCS:.idl=.tlb) \
|
||||
$(BISON_SRCS) $(LEX_SRCS) $(EXTRA_OBJS)
|
||||
@ -210,14 +207,6 @@ install install-lib install-dev uninstall::
|
||||
|
||||
.PHONY: install install-lib install-dev uninstall
|
||||
|
||||
# Rules for resources
|
||||
|
||||
rsrc.pot: $(WRC)
|
||||
$(WRC) $(RCFLAGS) -O pot -o $@ $(PO_SRCS)
|
||||
|
||||
$(RC_SRCS:.rc=.res): $(WRC)
|
||||
$(PO_SRCS:.rc=.res): $(ALL_MO_FILES)
|
||||
|
||||
# Misc. rules
|
||||
|
||||
$(IDL_GEN_HEADERS) $(IDL_GEN_C_SRCS) $(IDL_TLB_SRCS:.idl=.tlb) $(IDL_TLB_RES) $(IDL_R_SRCS:.idl=_r.res): $(WIDL)
|
||||
|
@ -25,6 +25,7 @@ build.rc: dummy
|
||||
build.nfo:
|
||||
-$(CC) -v 2>$@
|
||||
|
||||
build.res: build.nfo
|
||||
build.res: build.rc build.nfo
|
||||
$(WRC) $(RCFLAGS) -o $@ build.rc
|
||||
|
||||
@MAKE_PROG_RULES@
|
||||
|
@ -96,6 +96,7 @@ static const char Usage[] =
|
||||
static void fatal_error( const char *msg, ... ) __attribute__ ((__format__ (__printf__, 1, 2)));
|
||||
static void fatal_perror( const char *msg, ... ) __attribute__ ((__format__ (__printf__, 1, 2)));
|
||||
static int output( const char *format, ... ) __attribute__ ((__format__ (__printf__, 1, 2)));
|
||||
static char *strmake( const char* fmt, ... ) __attribute__ ((__format__ (__printf__, 1, 2)));
|
||||
|
||||
/*******************************************************************
|
||||
* fatal_error
|
||||
@ -340,6 +341,24 @@ static struct incl_file *find_include_file( const char *name )
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
* find_target_src_file
|
||||
*
|
||||
* Check if we have a source file as a target for the specified source with a different extension.
|
||||
*/
|
||||
static struct incl_file *find_target_src_file( const char *name, const char *ext )
|
||||
{
|
||||
struct incl_file *ret;
|
||||
char *p, *match = xmalloc( strlen( name ) + strlen( ext ) + 1 );
|
||||
|
||||
strcpy( match, name );
|
||||
if ((p = get_extension( match ))) strcpy( p, ext );
|
||||
else strcat( match, ext );
|
||||
ret = find_src_file( match );
|
||||
free( match );
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
* add_include
|
||||
*
|
||||
@ -858,6 +877,7 @@ static void parse_file( struct incl_file *source, int src )
|
||||
/* don't try to open certain types of files */
|
||||
if (strendswith( source->name, ".tlb" ) ||
|
||||
strendswith( source->name, ".res" ) ||
|
||||
strendswith( source->name, ".pot" ) ||
|
||||
strendswith( source->name, ".x" ))
|
||||
{
|
||||
source->filename = xstrdup( source->name );
|
||||
@ -926,7 +946,7 @@ static void output_include( struct incl_file *pFile, struct incl_file *owner, in
|
||||
static void output_sources(void)
|
||||
{
|
||||
struct incl_file *source;
|
||||
int i, column, mc_srcs = 0;
|
||||
int i, column, po_srcs = 0, mc_srcs = 0;
|
||||
|
||||
LIST_FOR_EACH_ENTRY( source, &sources, struct incl_file, entry )
|
||||
{
|
||||
@ -962,7 +982,19 @@ static void output_sources(void)
|
||||
}
|
||||
else if (!strcmp( ext, "rc" )) /* resource file */
|
||||
{
|
||||
column += output( "rsrc.pot %s.res: %s", obj, source->filename );
|
||||
if (find_target_src_file( source->name, ".pot" ))
|
||||
{
|
||||
output( "%s.res: $(WRC) $(ALL_MO_FILES) %s\n", obj, source->filename );
|
||||
output( "\t$(WRC) $(RCFLAGS) -o $@ %s\n", source->filename );
|
||||
column += output( "%s.res rsrc.pot:", obj );
|
||||
po_srcs++;
|
||||
}
|
||||
else
|
||||
{
|
||||
output( "%s.res: $(WRC) %s\n", obj, source->filename );
|
||||
output( "\t$(WRC) $(RCFLAGS) -o $@ %s\n", source->filename );
|
||||
column += output( "%s.res:", obj );
|
||||
}
|
||||
}
|
||||
else if (!strcmp( ext, "mc" )) /* message file */
|
||||
{
|
||||
@ -1004,7 +1036,7 @@ static void output_sources(void)
|
||||
|
||||
column += output( ": %s", source->filename );
|
||||
}
|
||||
else if (!strcmp( ext, "tlb" ) || !strcmp( ext, "res" ))
|
||||
else if (!strcmp( ext, "tlb" ) || !strcmp( ext, "res" ) || !strcmp( ext, "pot" ))
|
||||
{
|
||||
continue; /* nothing to do for typelib files */
|
||||
}
|
||||
@ -1024,6 +1056,20 @@ static void output_sources(void)
|
||||
|
||||
/* rules for files that depend on multiple sources */
|
||||
|
||||
if (po_srcs)
|
||||
{
|
||||
column = output( "rsrc.pot: $(WRC)" );
|
||||
LIST_FOR_EACH_ENTRY( source, &sources, struct incl_file, entry )
|
||||
if (strendswith( source->name, ".rc" ) && find_target_src_file( source->name, ".pot" ))
|
||||
output_filename( source->filename, &column );
|
||||
output( "\n" );
|
||||
column = output( "\t$(WRC) $(RCFLAGS) -O pot -o $@" );
|
||||
LIST_FOR_EACH_ENTRY( source, &sources, struct incl_file, entry )
|
||||
if (strendswith( source->name, ".rc" ) && find_target_src_file( source->name, ".pot" ))
|
||||
output_filename( source->filename, &column );
|
||||
output( "\n" );
|
||||
}
|
||||
|
||||
if (mc_srcs)
|
||||
{
|
||||
column = output( "msg.pot: $(WMC)" );
|
||||
|
Loading…
x
Reference in New Issue
Block a user