libc: generate nslexer.c,nsparser.c at build stage

The files are generated via flex and bison. Until now, this step was
performed when preparing the libc port. Unfortunately, the generated
files have subtle differences depending on the flex/bison versions
installed in the host. For example, the bison version number appears in
the generated code. This, in turn, breaks the hash mechanism of the
depot where a src/libc archive ends up being slightly different when
created on different hosts.

By moving the code generation to the build stage, the src/libc archive
merely contains the nslexer.l and nsparser.y source files but not the
generated files.
This commit is contained in:
Norman Feske 2017-08-18 14:37:35 +02:00 committed by Christian Helmuth
parent ff935ee1b0
commit aec4f0db2d
3 changed files with 23 additions and 19 deletions

View File

@ -33,3 +33,18 @@ INC_DIR += $(LIBC_PORT_DIR)/include/libc/sys
INC_DIR += $(LIBC_DIR)/lib/libc/resolv
vpath %.c $(LIBC_NET_DIR)
nslexer.o: nsparser.c nsparser.c
nslexer.c: nslexer.l
$(MSG_CONVERT)$(notdir $@)
$(VERBOSE)flex -P_nsyy -t $< | sed -e '/YY_BUF_SIZE/s/16384/1024/' > $@
vpath nslexer.l $(LIBC_NET_DIR)
nsparser.c: nsparser.y
$(MSG_CONVERT)$(notdir $@)
$(VERBOSE)bison -d -p_nsyy $< \
--defines=$(LIBC_PORT_DIR)/src/lib/libc/lib/libc/net/nsparser.h --output=$@
vpath nsparser.y $(LIBC_NET_DIR)

View File

@ -1 +1 @@
0885f819fb527fb3930cf56b7bc118f364c6f074
cefebffc6e8f129acb24de192373731461abe2f6

View File

@ -197,23 +197,6 @@ DIR_CONTENT(include/libc-arm/machine) := \
# Rules for generating files
#
generated_files += src/lib/libc/lib/libc/net/nslexer.c
src/lib/libc/lib/libc/net/nslexer.l : $(DOWNLOADS)
src/lib/libc/lib/libc/net/nslexer.c: src/lib/libc/lib/libc/net/nslexer.l
@$(MSG_GENERATE)$(notdir $@)
$(VERBOSE)flex -P_nsyy -t $< | sed -e '/YY_BUF_SIZE/s/16384/1024/' > $@
generated_files += src/lib/libc/lib/libc/net/nsparser.c
src/lib/libc/lib/libc/net/nsparser.y : $(DOWNLOADS)
src/lib/libc/lib/libc/net/nsparser.c: src/lib/libc/lib/libc/net/nsparser.y
@$(MSG_GENERATE)$(notdir $@)
$(VERBOSE)bison -d -p_nsyy $< \
--defines=src/lib/libc/lib/libc/net/nsparser.h --output=$@
src/lib/libc/include/rpcsvc/nis.h: src/lib/libc/include/rpcsvc/nis_object.x
@$(MSG_GENERATE)$(notdir $@)
$(VERBOSE)rpcgen -C -h -DWANT_NFS3 $< -o $@
@ -224,7 +207,7 @@ src/lib/libc/include/rpcsvc/nis_object.x : $(DOWNLOADS)
@$(MSG_GENERATE)$(notdir $@)
$(VERBOSE)rpcgen -C -h -DWANT_NFS3 $< -o $@
generated_files += \
generated_rpcsvc_files := \
$(addprefix src/lib/libc/include/rpcsvc/,\
bootparam_prot.h nfs_prot.h nlm_prot.h rstat.h ypupdate_prot.h \
crypt.h nis_cache.h pmap_prot.h rwall.h yp.h \
@ -233,6 +216,12 @@ generated_files += \
mount.h nis.h rquota.h yppasswd.h) \
src/lib/libc/include/rpc/rpcb_prot.h
$(generated_rpcsvc_files:.h=.x): $(DOWNLOADS)
$(generated_rpcsvc_files) : $(generated_rpcsvc_files:.h=.x)
generated_files += $(generated_rpcsvc_files)
# generate files before assembling the public include directory tree
_dirs: $(generated_files)
$(generated_files) : $(DOWNLOADS)