sim: bpf: hoist cgen rules to top-level
authorMike Frysinger <vapier@gentoo.org>
Mon, 2 Jan 2023 02:00:12 +0000 (21:00 -0500)
committerMike Frysinger <vapier@gentoo.org>
Tue, 3 Jan 2023 01:28:08 +0000 (20:28 -0500)
sim/Makefile.in
sim/bpf/Makefile.in
sim/bpf/local.mk

index b19c0c2986d405101e4d8bd59803252debe6ce6f..ca080973f4e2528d5f75135a96d27db1d1c71707 100644 (file)
@@ -3489,6 +3489,33 @@ testsuite/common/bits64m63.c: testsuite/common/bits-gen$(EXEEXT) testsuite/commo
 @SIM_ENABLE_ARCH_bpf_TRUE@     $(AM_V_at)$(SHELL) $(srcroot)/move-if-change bpf/mloop-be.cin bpf/mloop-be.c
 @SIM_ENABLE_ARCH_bpf_TRUE@     $(AM_V_at)touch $@
 
+@SIM_ENABLE_ARCH_bpf_TRUE@bpf/cgen: bpf/cgen-arch bpf/cgen-cpu bpf/cgen-defs-le bpf/cgen-defs-be bpf/cgen-decode-le bpf/cgen-decode-be
+
+@SIM_ENABLE_ARCH_bpf_TRUE@bpf/cgen-arch:
+@SIM_ENABLE_ARCH_bpf_TRUE@     $(AM_V_GEN)mach=bpf cpu=bpfbf FLAGS="with-scache"; $(CGEN_GEN_ARCH)
+@SIM_ENABLE_ARCH_bpf_TRUE@bpf/arch.h bpf/arch.c bpf/cpuall.h: @CGEN_MAINT@ bpf/cgen-arch
+
+@SIM_ENABLE_ARCH_bpf_TRUE@bpf/cgen-cpu:
+@SIM_ENABLE_ARCH_bpf_TRUE@     $(AM_V_GEN)isa=ebpfle,ebpfbe cpu=bpfbf mach=bpf FLAGS="with-multiple-isa with-scache"; $(CGEN_GEN_CPU)
+@SIM_ENABLE_ARCH_bpf_TRUE@     $(AM_V_at)rm -f $(srcdir)/bpf/model.c
+@SIM_ENABLE_ARCH_bpf_TRUE@bpf/cpu.h bpf/cpu.c bpf/model.c: @CGEN_MAINT@ bpf/cgen-cpu
+
+@SIM_ENABLE_ARCH_bpf_TRUE@bpf/cgen-defs-le:
+@SIM_ENABLE_ARCH_bpf_TRUE@     $(AM_V_GEN)isa=ebpfle cpu=bpfbf mach=bpf FLAGS="with-scache" SUFFIX="-le"; $(CGEN_GEN_DEFS)
+@SIM_ENABLE_ARCH_bpf_TRUE@bpf/defs-le.h: @CGEN_MAINT@ bpf/cgen-defs-le
+
+@SIM_ENABLE_ARCH_bpf_TRUE@bpf/cgen-defs-be:
+@SIM_ENABLE_ARCH_bpf_TRUE@     $(AM_V_GEN)isa=ebpfbe cpu=bpfbf mach=bpf FLAGS="with-scache" SUFFIX="-be"; $(CGEN_GEN_DEFS)
+@SIM_ENABLE_ARCH_bpf_TRUE@bpf/defs-be.h: @CGEN_MAINT@ bpf/cgen-defs-be
+
+@SIM_ENABLE_ARCH_bpf_TRUE@bpf/cgen-decode-le:
+@SIM_ENABLE_ARCH_bpf_TRUE@     $(AM_V_GEN)isa=ebpfle cpu=bpfbf mach=bpf FLAGS="with-scache" SUFFIX="-le" EXTRAFILES="$(CGEN_CPU_SEM)"; $(CGEN_GEN_DECODE)
+@SIM_ENABLE_ARCH_bpf_TRUE@bpf/sem-le.c bpf/decode-le.c bpf/decode-le.h: @CGEN_MAINT@ bpf/cgen-decode-vle
+
+@SIM_ENABLE_ARCH_bpf_TRUE@bpf/cgen-decode-be:
+@SIM_ENABLE_ARCH_bpf_TRUE@     $(AM_V_GEN)isa=ebpfbe cpu=bpfbf mach=bpf FLAGS="with-scache" SUFFIX="-be" EXTRAFILES="$(CGEN_CPU_SEM)"; $(CGEN_GEN_DECODE)
+@SIM_ENABLE_ARCH_bpf_TRUE@bpf/sem-be.c bpf/decode-be.c bpf/decode-be.h: @CGEN_MAINT@ bpf/cgen-decode-be
+
 # These rules are copied from automake, but tweaked to use FOR_BUILD variables.
 @SIM_ENABLE_ARCH_cr16_TRUE@cr16/gencode$(EXEEXT): $(cr16_gencode_OBJECTS) $(cr16_gencode_DEPENDENCIES) cr16/$(am__dirstamp)
 @SIM_ENABLE_ARCH_cr16_TRUE@    $(AM_V_CCLD)$(LINK_FOR_BUILD) $(cr16_gencode_OBJECTS) $(cr16_gencode_LDADD)
index 7a17de8d47587fb6c96fc497840c677b53257522..2732a0e6071ec7a015671484d677950a4c9a31a1 100644 (file)
@@ -33,8 +33,6 @@ SIM_OBJS = \
 
 SIM_EXTRA_CFLAGS = -DWITH_TARGET_WORD_BITSIZE=64
 
-SIM_EXTRA_CLEAN = bpf-clean
-
 ## COMMON_POST_CONFIG_FRAG
 
 # Dependencies for binaries from CGEN generated source
@@ -61,91 +59,3 @@ sem-be.o: sem-be.c
        $(POSTCOMPILE)
 
 arch = bpf
-
-CGEN_COMMON_DEPS = \
-       $(CGEN_READ_SCM) \
-       $(srcdir)/../../cpu/bpf.cpu \
-       $(srcdir)/../../cpu/bpf.opc \
-       Makefile
-
-stamp-arch: $(CGEN_COMMON_DEPS) $(CGEN_ARCH_SCM)
-       $(MAKE) cgen-arch $(CGEN_FLAGS_TO_PASS) \
-               mach=bpf cpu=bpfbf \
-               archfile=$(srcdir)/../../cpu/bpf.cpu \
-               FLAGS="with-scache"
-       $(SILENCE) touch $@
-$(srcdir)/arch.h $(srcdir)/arch.c $(srcdir)/cpuall.h: $(CGEN_MAINT) stamp-arch
-       @true
-
-stamp-cpu: $(CGEN_COMMON_DEPS) $(CGEN_CPU_SCM)
-       $(MAKE) cgen-cpu  $(CGEN_FLAGS_TO_PASS) \
-               isa=ebpfle,ebpfbe cpu=bpfbf mach=bpf \
-               archfile=$(srcdir)/../../cpu/bpf.cpu \
-               FLAGS="with-multiple-isa with-scache"
-       rm -f $(srcdir)/model.c
-       $(SILENCE) touch $@
-$(srcdir)/cpu.h $(srcdir)/cpu.c $(srcdir)/model.c: $(CGEN_MAINT) stamp-cpu
-       @true
-
-# We need to generate a group of files per ISA.
-# For eBPF little-endian:
-#    defs-le.h
-#    sem-le.c, decode-le.c, decode-le.h
-#    $(objdir)/mloop-le.c $(objdir)/eng-le.h
-# For eBPF big-endian:
-#    defs-be.h
-#    sem-be.c, decode-be.c, decode-be.h
-#    $(objdir)/mloop-be.c $(objdir)/eng-le.h
-#
-# The rules below take care of that.
-
-stamp-defs-le: $(CGEN_COMMON_DEPS) $(CGEN_CPU_SCM)
-       $(MAKE) cgen-defs $(CGEN_FLAGS_TO_PASS) \
-               isa=ebpfle cpu=bpfbf mach=bpf \
-               archfile=$(srcdir)/../../cpu/bpf.cpu \
-               FLAGS="with-scache" \
-                SUFFIX="-le"
-       $(SILENCE) touch $@
-$(srcdir)/defs-le.h: $(CGEN_MAINT) stamp-defs-le
-       @true
-
-
-stamp-defs-be: $(CGEN_COMMON_DEPS) $(CGEN_CPU_SCM)
-       $(MAKE) cgen-defs $(CGEN_FLAGS_TO_PASS) \
-               isa=ebpfbe cpu=bpfbf mach=bpf \
-               archfile=$(srcdir)/../../cpu/bpf.cpu \
-               FLAGS="with-scache" \
-                SUFFIX="-be"
-       $(SILENCE) touch $@
-$(srcdir)/defs-be.h: $(CGEN_MAINT) stamp-defs-be
-       @true
-
-stamp-decode-le: $(CGEN_COMMON_DEPS) $(CGEN_CPU_SCM) $(GEN_DECODE_SCM)
-       $(MAKE) cgen-decode $(CGEN_FLAGS_TO_PASS) \
-               isa=ebpfle cpu=bpfbf mach=bpf \
-               archfile=$(srcdir)/../../cpu/bpf.cpu \
-               FLAGS="with-scache" \
-                SUFFIX="-le" \
-               EXTRAFILES="$(CGEN_CPU_SEM)"
-       $(SILENCE) touch $@
-$(srcdir)/sem-le.c $(srcdir)/decode-le.c $(srcdir)/decode-le.h: \
-              $(CGEN_MAINT) stamp-decode-le
-       @true
-
-
-stamp-decode-be: $(CGEN_COMMON_DEPS) $(CGEN_CPU_SCM) $(GEN_DECODE_SCM)
-       $(MAKE) cgen-decode $(CGEN_FLAGS_TO_PASS) \
-               isa=ebpfbe cpu=bpfbf mach=bpf \
-               archfile=$(srcdir)/../../cpu/bpf.cpu \
-               FLAGS="with-scache" \
-                SUFFIX="-be" \
-               EXTRAFILES="$(CGEN_CPU_SEM)"
-       $(SILENCE) touch $@
-$(srcdir)/sem-be.c $(srcdir)/decode-be.c $(srcdir)/decode-be.h: \
-              $(CGEN_MAINT) stamp-decode-be
-       @true
-
-.PHONY = bpf-clean
-
-bpf-clean:
-       rm -f stamp-arch stamp-cpu stamp-decode stamp-defs
index 7382f6163bc29c170b75e9ce4c09f1d53ef95e05..7221dafa9b21891d875a3d179945fbd2f8c142a8 100644 (file)
@@ -55,3 +55,43 @@ SIM_ALL_RECURSIVE_DEPS += $(%C%_BUILD_OUTPUTS)
        $(AM_V_at)touch $@
 
 MOSTLYCLEANFILES += $(%C%_BUILD_OUTPUTS)
+
+## Target that triggers all cgen targets that works when --disable-cgen-maint.
+%D%/cgen: %D%/cgen-arch %D%/cgen-cpu %D%/cgen-defs-le %D%/cgen-defs-be %D%/cgen-decode-le %D%/cgen-decode-be
+
+%D%/cgen-arch:
+       $(AM_V_GEN)mach=bpf cpu=bpfbf FLAGS="with-scache"; $(CGEN_GEN_ARCH)
+%D%/arch.h %D%/arch.c %D%/cpuall.h: @CGEN_MAINT@ %D%/cgen-arch
+
+%D%/cgen-cpu:
+       $(AM_V_GEN)isa=ebpfle,ebpfbe cpu=bpfbf mach=bpf FLAGS="with-multiple-isa with-scache"; $(CGEN_GEN_CPU)
+       $(AM_V_at)rm -f $(srcdir)/%D%/model.c
+%D%/cpu.h %D%/cpu.c %D%/model.c: @CGEN_MAINT@ %D%/cgen-cpu
+
+## We need to generate a group of files per ISA.
+## For eBPF little-endian:
+##    defs-le.h
+##    sem-le.c, decode-le.c, decode-le.h
+##    $(objdir)/mloop-le.c $(objdir)/eng-le.h
+## For eBPF big-endian:
+##    defs-be.h
+##    sem-be.c, decode-be.c, decode-be.h
+##    $(objdir)/mloop-be.c $(objdir)/eng-le.h
+##
+## The rules below take care of that.
+
+%D%/cgen-defs-le:
+       $(AM_V_GEN)isa=ebpfle cpu=bpfbf mach=bpf FLAGS="with-scache" SUFFIX="-le"; $(CGEN_GEN_DEFS)
+%D%/defs-le.h: @CGEN_MAINT@ %D%/cgen-defs-le
+
+%D%/cgen-defs-be:
+       $(AM_V_GEN)isa=ebpfbe cpu=bpfbf mach=bpf FLAGS="with-scache" SUFFIX="-be"; $(CGEN_GEN_DEFS)
+%D%/defs-be.h: @CGEN_MAINT@ %D%/cgen-defs-be
+
+%D%/cgen-decode-le:
+       $(AM_V_GEN)isa=ebpfle cpu=bpfbf mach=bpf FLAGS="with-scache" SUFFIX="-le" EXTRAFILES="$(CGEN_CPU_SEM)"; $(CGEN_GEN_DECODE)
+%D%/sem-le.c %D%/decode-le.c %D%/decode-le.h: @CGEN_MAINT@ %D%/cgen-decode-vle
+
+%D%/cgen-decode-be:
+       $(AM_V_GEN)isa=ebpfbe cpu=bpfbf mach=bpf FLAGS="with-scache" SUFFIX="-be" EXTRAFILES="$(CGEN_CPU_SEM)"; $(CGEN_GEN_DECODE)
+%D%/sem-be.c %D%/decode-be.c %D%/decode-be.h: @CGEN_MAINT@ %D%/cgen-decode-be