From 9c085cba0a33e1e53f522133805804c2d4f570f2 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Sat, 9 Sep 2006 13:16:22 +0200 Subject: [PATCH] makefiles: Add global rules for bison and lex files. Also build the .c and .h files separately to allow parallel makes. --- .gitignore | 2 +- Make.rules.in | 19 +++++++++++++++---- dlls/msi/Makefile.in | 25 ++++++++----------------- libs/wpp/Makefile.in | 19 +++++-------------- programs/winedbg/Makefile.in | 19 +++++-------------- programs/winhelp/Makefile.in | 8 +++----- tools/widl/Makefile.in | 19 +++++-------------- tools/wmc/Makefile.in | 15 ++++----------- tools/wrc/Makefile.in | 19 +++++-------------- 9 files changed, 51 insertions(+), 94 deletions(-) diff --git a/.gitignore b/.gitignore index 2bbaa52bdcc..1d75513e114 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ *.so *.tab.[ch] *.tlb +*.yy.c *_[cips].c *~ /Make.rules @@ -21,4 +22,3 @@ /tags /wine Makefile -lex.yy.c diff --git a/Make.rules.in b/Make.rules.in index 0f53804192f..1d3f4c33ae9 100644 --- a/Make.rules.in +++ b/Make.rules.in @@ -109,16 +109,16 @@ prog_manext = 1 api_manext = 3w conf_manext = 5 CLEAN_FILES = *.o *.a *.so *.ln *.$(LIBEXT) \\\#*\\\# *~ *% .\\\#* *.bak *.orig *.rej \ - *.flc *.res *.mc.rc *.tab.[ch] @LEX_OUTPUT_ROOT@.c core + *.flc *.res *.mc.rc *.tab.[ch] *.yy.c core -OBJS = $(C_SRCS:.c=.o) $(EXTRA_OBJS) +OBJS = $(C_SRCS:.c=.o) $(BISON_SRCS:.y=.tab.o) $(LEX_SRCS:.l=.yy.o) $(EXTRA_OBJS) RCOBJS = $(RC_SRCS:.rc=.res.o) LINTS = $(C_SRCS:.c=.ln) # Implicit rules -.SUFFIXES: .mc .rc .mc.rc .res .res.o .spec .spec.o .idl .tlb .h .ok .sfd .ttf .man.in .man _c.c _i.c _p.c _s.c +.SUFFIXES: .mc .rc .mc.rc .res .res.o .spec .spec.o .idl .tlb .h .y .l .tab.c .tab.h .yy.c .ok .sfd .ttf .man.in .man _c.c _i.c _p.c _s.c .c.o: $(CC) -c $(ALLCFLAGS) -o $@ $< @@ -126,6 +126,15 @@ LINTS = $(C_SRCS:.c=.ln) .s.o: $(AS) -o $@ $< +.y.tab.c: + $(BISON) $(BISONFLAGS) -o $@ $< + +.y.tab.h: + $(BISON) $(BISONFLAGS) --defines=$@ -o /dev/null $< + +.l.yy.c: + $(LEX) $(LEXFLAGS) -t $< >$@ || ($(RM) $@ && exit 1) + .mc.mc.rc: $(LDPATH) $(WMC) -i -U -H /dev/null -o $@ $< @@ -212,11 +221,13 @@ winapi_check:: dummy # Rules for dependencies +DEPEND_SRCS = $(C_SRCS) $(C_SRCS16) $(RC_SRCS) $(RC_SRCS16) $(MC_SRCS) $(IDL_SRCS) $(BISON_SRCS) $(LEX_SRCS) $(EXTRA_SRCS) + $(SUBDIRS:%=%/__depend__): dummy @cd `dirname $@` && $(MAKE) depend depend: $(IDL_SRCS:.idl=.h) $(SUBDIRS:%=%/__depend__) - $(MAKEDEP) -C$(SRCDIR) -S$(TOPSRCDIR) -T$(TOPOBJDIR) $(EXTRAINCL) $(C_SRCS) $(C_SRCS16) $(RC_SRCS) $(RC_SRCS16) $(MC_SRCS) $(IDL_SRCS) $(EXTRA_SRCS) + $(MAKEDEP) -C$(SRCDIR) -S$(TOPSRCDIR) -T$(TOPOBJDIR) $(EXTRAINCL) $(DEPEND_SRCS) .PHONY: depend $(SUBDIRS:%=%/__depend__) diff --git a/dlls/msi/Makefile.in b/dlls/msi/Makefile.in index 47728e0768a..3bd3783a1ec 100644 --- a/dlls/msi/Makefile.in +++ b/dlls/msi/Makefile.in @@ -45,6 +45,10 @@ C_SRCS = \ upgrade.c \ where.c +BISON_SRCS = \ + cond.y \ + sql.y + RC_SRCS = msi.rc RC_BINSRC = msi.rc RC_BINARIES = \ @@ -52,23 +56,10 @@ RC_BINARIES = \ instadvert.bmp \ instlocal.bmp -EXTRA_SRCS = sql.y cond.y -EXTRA_OBJS = sql.tab.o cond.tab.o - @MAKE_DLL_RULES@ -sql.tab.c sql.tab.h: sql.y - $(BISON) -d $(SRCDIR)/sql.y -o sql.tab.c - -cond.tab.c cond.tab.h: cond.y - $(BISON) -d $(SRCDIR)/cond.y -o cond.tab.c - -# hack to allow parallel make -sql.tab.h: sql.tab.c -sql.tab.o: sql.tab.h -cond.tab.h: cond.tab.c -cond.tab.o: cond.tab.h - -tokenize.o: sql.tab.h - ### Dependencies: + +cond.tab.o: cond.tab.c +sql.tab.o: sql.tab.c +tokenize.o: sql.tab.h diff --git a/libs/wpp/Makefile.in b/libs/wpp/Makefile.in index 9d501e925de..ff6744ce246 100644 --- a/libs/wpp/Makefile.in +++ b/libs/wpp/Makefile.in @@ -8,8 +8,8 @@ C_SRCS = \ preproc.c \ wpp.c -EXTRA_SRCS = ppy.y ppl.l -EXTRA_OBJS = ppy.tab.o @LEX_OUTPUT_ROOT@.o +LEX_SRCS = ppl.l +BISON_SRCS = ppy.y all: $(MODULE) @@ -20,16 +20,7 @@ $(MODULE): $(OBJS) $(AR) $@ $(OBJS) $(RANLIB) $@ -ppy.tab.c ppy.tab.h: ppy.y - $(BISON) -d $(SRCDIR)/ppy.y -o ppy.tab.c - -# hack to allow parallel make -ppy.tab.h: ppy.tab.c -ppy.tab.o: ppy.tab.h - -@LEX_OUTPUT_ROOT@.c: ppl.l - $(LEX) -o$@ $(SRCDIR)/ppl.l - -@LEX_OUTPUT_ROOT@.o: ppy.tab.h - ### Dependencies: + +ppy.tab.o: ppy.tab.c +ppl.yy.o: ppl.yy.c ppy.tab.h diff --git a/programs/winedbg/Makefile.in b/programs/winedbg/Makefile.in index 6c2274bc99d..35a96d040b9 100644 --- a/programs/winedbg/Makefile.in +++ b/programs/winedbg/Makefile.in @@ -28,8 +28,8 @@ C_SRCS = \ types.c \ winedbg.c -EXTRA_SRCS = dbg.y debug.l -EXTRA_OBJS = dbg.tab.o @LEX_OUTPUT_ROOT@.o +LEX_SRCS = debug.l +BISON_SRCS = dbg.y MANPAGES = winedbg.man @@ -37,18 +37,6 @@ MANPAGES = winedbg.man all: $(MANPAGES) -dbg.tab.c dbg.tab.h: dbg.y - $(BISON) -d -t $(SRCDIR)/dbg.y -o dbg.tab.c - -# hack to allow parallel make -dbg.tab.h: dbg.tab.c -dbg.tab.o: dbg.tab.h - -@LEX_OUTPUT_ROOT@.c: debug.l - $(LEX) $(SRCDIR)/debug.l - -@LEX_OUTPUT_ROOT@.o: dbg.tab.h - install:: $(MANPAGES) $(DESTDIR)$(mandir)/man$(prog_manext) $(INSTALL_DATA) winedbg.man $(DESTDIR)$(mandir)/man$(prog_manext)/winedbg.$(prog_manext) @@ -56,3 +44,6 @@ uninstall:: $(RM) $(DESTDIR)$(mandir)/man$(prog_manext)/winedbg.$(prog_manext) ### Dependencies: + +dbg.tab.o: dbg.tab.c +debug.yy.o: debug.yy.c dbg.tab.h diff --git a/programs/winhelp/Makefile.in b/programs/winhelp/Makefile.in index 3d6c5b00f15..f5cf11be6a6 100644 --- a/programs/winhelp/Makefile.in +++ b/programs/winhelp/Makefile.in @@ -13,8 +13,7 @@ C_SRCS = \ string.c \ winhelp.c -EXTRA_SRCS = macro.lex.l -EXTRA_OBJS = @LEX_OUTPUT_ROOT@.o +LEX_SRCS = macro.lex.l EXTRARCFLAGS = -DWINELIB @@ -22,7 +21,6 @@ RC_SRCS = rsrc.rc @MAKE_PROG_RULES@ -@LEX_OUTPUT_ROOT@.c: macro.lex.l - $(LEX) $(SRCDIR)/macro.lex.l - ### Dependencies: + +macro.lex.yy.o: macro.lex.yy.c diff --git a/tools/widl/Makefile.in b/tools/widl/Makefile.in index 8d7861b4313..a2afefc49f8 100644 --- a/tools/widl/Makefile.in +++ b/tools/widl/Makefile.in @@ -20,8 +20,8 @@ C_SRCS = \ widl.c \ write_msft.c -EXTRA_SRCS = parser.y parser.l -EXTRA_OBJS = parser.tab.o @LEX_OUTPUT_ROOT@.o +LEX_SRCS = parser.l +BISON_SRCS = parser.y INSTALLDIRS = $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man$(prog_manext) @@ -32,18 +32,6 @@ all: $(PROGRAMS) $(MANPAGES) widl$(EXEEXT): $(OBJS) $(LIBWPP) $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBWPP) $(LIBPORT) $(LEXLIB) $(LDFLAGS) -parser.tab.c parser.tab.h: parser.y - $(BISON) -d -t $(SRCDIR)/parser.y -o parser.tab.c - -# hack to allow parallel make -parser.tab.h: parser.tab.c -parser.tab.o: parser.tab.h - -@LEX_OUTPUT_ROOT@.c: parser.l - $(LEX) $(SRCDIR)/parser.l - -@LEX_OUTPUT_ROOT@.o: parser.tab.h - install:: $(PROGRAMS) $(MANPAGES) $(INSTALLDIRS) $(INSTALL_PROGRAM) widl$(EXEEXT) $(DESTDIR)$(bindir)/widl$(EXEEXT) $(INSTALL_DATA) widl.man $(DESTDIR)$(mandir)/man$(prog_manext)/widl.$(prog_manext) @@ -52,3 +40,6 @@ uninstall:: $(RM) $(DESTDIR)$(bindir)/widl$(EXEEXT) $(DESTDIR)$(mandir)/man$(prog_manext)/widl.$(prog_manext) ### Dependencies: + +parser.tab.o: parser.tab.c +parser.yy.o: parser.yy.c parser.tab.h diff --git a/tools/wmc/Makefile.in b/tools/wmc/Makefile.in index 5c9971024be..a9b05b8bfb4 100644 --- a/tools/wmc/Makefile.in +++ b/tools/wmc/Makefile.in @@ -15,27 +15,17 @@ C_SRCS = \ wmc.c \ write.c -EXTRA_SRCS = mcy.y -EXTRA_OBJS = mcy.tab.o +BISON_SRCS = mcy.y INSTALLDIRS = $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man$(prog_manext) all: $(PROGRAMS) $(MANPAGES) -mcl.o: mcy.tab.h - @MAKE_RULES@ wmc$(EXEEXT): $(OBJS) $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBWINE_LDFLAGS) $(LIBPORT) $(LEXLIB) $(LDFLAGS) -mcy.tab.c mcy.tab.h: mcy.y - $(BISON) -d -t $(SRCDIR)/mcy.y -o mcy.tab.c - -# hack to allow parallel make -mcy.tab.h: mcy.tab.c -mcy.tab.o: mcy.tab.h - install:: $(PROGRAMS) $(MANPAGES) $(INSTALLDIRS) $(INSTALL_DATA) wmc.man $(DESTDIR)$(mandir)/man$(prog_manext)/wmc.$(prog_manext) $(INSTALL_PROGRAM) wmc$(EXEEXT) $(DESTDIR)$(bindir)/wmc$(EXEEXT) @@ -44,3 +34,6 @@ uninstall:: $(RM) $(DESTDIR)$(bindir)/wmc$(EXEEXT) $(DESTDIR)$(mandir)/man$(prog_manext)/wmc.$(prog_manext) ### Dependencies: + +mcy.tab.o: mcy.tab.c +mcl.o: mcy.tab.h diff --git a/tools/wrc/Makefile.in b/tools/wrc/Makefile.in index dd2ca82f34e..382f089e064 100644 --- a/tools/wrc/Makefile.in +++ b/tools/wrc/Makefile.in @@ -19,8 +19,8 @@ C_SRCS = \ wrc.c \ writeres.c -EXTRA_SRCS = parser.y parser.l -EXTRA_OBJS = parser.tab.o @LEX_OUTPUT_ROOT@.o +LEX_SRCS = parser.l +BISON_SRCS = parser.y INSTALLDIRS = $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man$(prog_manext) @@ -31,18 +31,6 @@ all: $(PROGRAMS) $(MANPAGES) wrc$(EXEEXT): $(OBJS) $(LIBWPP) $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBWPP) $(LIBWINE_LDFLAGS) $(LIBPORT) $(LEXLIB) $(LDFLAGS) -parser.tab.c parser.tab.h: parser.y - $(BISON) -d -t $(SRCDIR)/parser.y -o parser.tab.c - -# hack to allow parallel make -parser.tab.h: parser.tab.c -parser.tab.o: parser.tab.h - -@LEX_OUTPUT_ROOT@.c: parser.l - $(LEX) $(SRCDIR)/parser.l - -@LEX_OUTPUT_ROOT@.o: parser.tab.h - install:: $(PROGRAMS) $(MANPAGES) $(INSTALLDIRS) $(INSTALL_DATA) wrc.man $(DESTDIR)$(mandir)/man$(prog_manext)/wrc.$(prog_manext) $(INSTALL_PROGRAM) wrc$(EXEEXT) $(DESTDIR)$(bindir)/wrc$(EXEEXT) @@ -51,3 +39,6 @@ uninstall:: $(RM) $(DESTDIR)$(bindir)/wrc$(EXEEXT) $(DESTDIR)$(mandir)/man$(prog_manext)/wrc.$(prog_manext) ### Dependencies: + +parser.tab.o: parser.tab.c +parser.yy.o: parser.yy.c parser.tab.h