makefiles: Add global rules for bison and lex files.

Also build the .c and .h files separately to allow parallel makes.
This commit is contained in:
Alexandre Julliard 2006-09-09 13:16:22 +02:00
parent dfd1abfa57
commit 9c085cba0a
9 changed files with 51 additions and 94 deletions

2
.gitignore vendored
View File

@ -10,6 +10,7 @@
*.so *.so
*.tab.[ch] *.tab.[ch]
*.tlb *.tlb
*.yy.c
*_[cips].c *_[cips].c
*~ *~
/Make.rules /Make.rules
@ -21,4 +22,3 @@
/tags /tags
/wine /wine
Makefile Makefile
lex.yy.c

View File

@ -109,16 +109,16 @@ prog_manext = 1
api_manext = 3w api_manext = 3w
conf_manext = 5 conf_manext = 5
CLEAN_FILES = *.o *.a *.so *.ln *.$(LIBEXT) \\\#*\\\# *~ *% .\\\#* *.bak *.orig *.rej \ 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) RCOBJS = $(RC_SRCS:.rc=.res.o)
LINTS = $(C_SRCS:.c=.ln) LINTS = $(C_SRCS:.c=.ln)
# Implicit rules # 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: .c.o:
$(CC) -c $(ALLCFLAGS) -o $@ $< $(CC) -c $(ALLCFLAGS) -o $@ $<
@ -126,6 +126,15 @@ LINTS = $(C_SRCS:.c=.ln)
.s.o: .s.o:
$(AS) -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: .mc.mc.rc:
$(LDPATH) $(WMC) -i -U -H /dev/null -o $@ $< $(LDPATH) $(WMC) -i -U -H /dev/null -o $@ $<
@ -212,11 +221,13 @@ winapi_check:: dummy
# Rules for dependencies # 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 $(SUBDIRS:%=%/__depend__): dummy
@cd `dirname $@` && $(MAKE) depend @cd `dirname $@` && $(MAKE) depend
depend: $(IDL_SRCS:.idl=.h) $(SUBDIRS:%=%/__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__) .PHONY: depend $(SUBDIRS:%=%/__depend__)

View File

@ -45,6 +45,10 @@ C_SRCS = \
upgrade.c \ upgrade.c \
where.c where.c
BISON_SRCS = \
cond.y \
sql.y
RC_SRCS = msi.rc RC_SRCS = msi.rc
RC_BINSRC = msi.rc RC_BINSRC = msi.rc
RC_BINARIES = \ RC_BINARIES = \
@ -52,23 +56,10 @@ RC_BINARIES = \
instadvert.bmp \ instadvert.bmp \
instlocal.bmp instlocal.bmp
EXTRA_SRCS = sql.y cond.y
EXTRA_OBJS = sql.tab.o cond.tab.o
@MAKE_DLL_RULES@ @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: ### Dependencies:
cond.tab.o: cond.tab.c
sql.tab.o: sql.tab.c
tokenize.o: sql.tab.h

View File

@ -8,8 +8,8 @@ C_SRCS = \
preproc.c \ preproc.c \
wpp.c wpp.c
EXTRA_SRCS = ppy.y ppl.l LEX_SRCS = ppl.l
EXTRA_OBJS = ppy.tab.o @LEX_OUTPUT_ROOT@.o BISON_SRCS = ppy.y
all: $(MODULE) all: $(MODULE)
@ -20,16 +20,7 @@ $(MODULE): $(OBJS)
$(AR) $@ $(OBJS) $(AR) $@ $(OBJS)
$(RANLIB) $@ $(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: ### Dependencies:
ppy.tab.o: ppy.tab.c
ppl.yy.o: ppl.yy.c ppy.tab.h

View File

@ -28,8 +28,8 @@ C_SRCS = \
types.c \ types.c \
winedbg.c winedbg.c
EXTRA_SRCS = dbg.y debug.l LEX_SRCS = debug.l
EXTRA_OBJS = dbg.tab.o @LEX_OUTPUT_ROOT@.o BISON_SRCS = dbg.y
MANPAGES = winedbg.man MANPAGES = winedbg.man
@ -37,18 +37,6 @@ MANPAGES = winedbg.man
all: $(MANPAGES) 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:: $(MANPAGES) $(DESTDIR)$(mandir)/man$(prog_manext)
$(INSTALL_DATA) winedbg.man $(DESTDIR)$(mandir)/man$(prog_manext)/winedbg.$(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) $(RM) $(DESTDIR)$(mandir)/man$(prog_manext)/winedbg.$(prog_manext)
### Dependencies: ### Dependencies:
dbg.tab.o: dbg.tab.c
debug.yy.o: debug.yy.c dbg.tab.h

View File

@ -13,8 +13,7 @@ C_SRCS = \
string.c \ string.c \
winhelp.c winhelp.c
EXTRA_SRCS = macro.lex.l LEX_SRCS = macro.lex.l
EXTRA_OBJS = @LEX_OUTPUT_ROOT@.o
EXTRARCFLAGS = -DWINELIB EXTRARCFLAGS = -DWINELIB
@ -22,7 +21,6 @@ RC_SRCS = rsrc.rc
@MAKE_PROG_RULES@ @MAKE_PROG_RULES@
@LEX_OUTPUT_ROOT@.c: macro.lex.l
$(LEX) $(SRCDIR)/macro.lex.l
### Dependencies: ### Dependencies:
macro.lex.yy.o: macro.lex.yy.c

View File

@ -20,8 +20,8 @@ C_SRCS = \
widl.c \ widl.c \
write_msft.c write_msft.c
EXTRA_SRCS = parser.y parser.l LEX_SRCS = parser.l
EXTRA_OBJS = parser.tab.o @LEX_OUTPUT_ROOT@.o BISON_SRCS = parser.y
INSTALLDIRS = $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man$(prog_manext) INSTALLDIRS = $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man$(prog_manext)
@ -32,18 +32,6 @@ all: $(PROGRAMS) $(MANPAGES)
widl$(EXEEXT): $(OBJS) $(LIBWPP) widl$(EXEEXT): $(OBJS) $(LIBWPP)
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBWPP) $(LIBPORT) $(LEXLIB) $(LDFLAGS) $(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:: $(PROGRAMS) $(MANPAGES) $(INSTALLDIRS)
$(INSTALL_PROGRAM) widl$(EXEEXT) $(DESTDIR)$(bindir)/widl$(EXEEXT) $(INSTALL_PROGRAM) widl$(EXEEXT) $(DESTDIR)$(bindir)/widl$(EXEEXT)
$(INSTALL_DATA) widl.man $(DESTDIR)$(mandir)/man$(prog_manext)/widl.$(prog_manext) $(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) $(RM) $(DESTDIR)$(bindir)/widl$(EXEEXT) $(DESTDIR)$(mandir)/man$(prog_manext)/widl.$(prog_manext)
### Dependencies: ### Dependencies:
parser.tab.o: parser.tab.c
parser.yy.o: parser.yy.c parser.tab.h

View File

@ -15,27 +15,17 @@ C_SRCS = \
wmc.c \ wmc.c \
write.c write.c
EXTRA_SRCS = mcy.y BISON_SRCS = mcy.y
EXTRA_OBJS = mcy.tab.o
INSTALLDIRS = $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man$(prog_manext) INSTALLDIRS = $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man$(prog_manext)
all: $(PROGRAMS) $(MANPAGES) all: $(PROGRAMS) $(MANPAGES)
mcl.o: mcy.tab.h
@MAKE_RULES@ @MAKE_RULES@
wmc$(EXEEXT): $(OBJS) wmc$(EXEEXT): $(OBJS)
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBWINE_LDFLAGS) $(LIBPORT) $(LEXLIB) $(LDFLAGS) $(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:: $(PROGRAMS) $(MANPAGES) $(INSTALLDIRS)
$(INSTALL_DATA) wmc.man $(DESTDIR)$(mandir)/man$(prog_manext)/wmc.$(prog_manext) $(INSTALL_DATA) wmc.man $(DESTDIR)$(mandir)/man$(prog_manext)/wmc.$(prog_manext)
$(INSTALL_PROGRAM) wmc$(EXEEXT) $(DESTDIR)$(bindir)/wmc$(EXEEXT) $(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) $(RM) $(DESTDIR)$(bindir)/wmc$(EXEEXT) $(DESTDIR)$(mandir)/man$(prog_manext)/wmc.$(prog_manext)
### Dependencies: ### Dependencies:
mcy.tab.o: mcy.tab.c
mcl.o: mcy.tab.h

View File

@ -19,8 +19,8 @@ C_SRCS = \
wrc.c \ wrc.c \
writeres.c writeres.c
EXTRA_SRCS = parser.y parser.l LEX_SRCS = parser.l
EXTRA_OBJS = parser.tab.o @LEX_OUTPUT_ROOT@.o BISON_SRCS = parser.y
INSTALLDIRS = $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man$(prog_manext) INSTALLDIRS = $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man$(prog_manext)
@ -31,18 +31,6 @@ all: $(PROGRAMS) $(MANPAGES)
wrc$(EXEEXT): $(OBJS) $(LIBWPP) wrc$(EXEEXT): $(OBJS) $(LIBWPP)
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBWPP) $(LIBWINE_LDFLAGS) $(LIBPORT) $(LEXLIB) $(LDFLAGS) $(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:: $(PROGRAMS) $(MANPAGES) $(INSTALLDIRS)
$(INSTALL_DATA) wrc.man $(DESTDIR)$(mandir)/man$(prog_manext)/wrc.$(prog_manext) $(INSTALL_DATA) wrc.man $(DESTDIR)$(mandir)/man$(prog_manext)/wrc.$(prog_manext)
$(INSTALL_PROGRAM) wrc$(EXEEXT) $(DESTDIR)$(bindir)/wrc$(EXEEXT) $(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) $(RM) $(DESTDIR)$(bindir)/wrc$(EXEEXT) $(DESTDIR)$(mandir)/man$(prog_manext)/wrc.$(prog_manext)
### Dependencies: ### Dependencies:
parser.tab.o: parser.tab.c
parser.yy.o: parser.yy.c parser.tab.h