Skip to content

Commit 9830327

Browse files
committed
WIP: add input for abi.h.in
1 parent 68c69df commit 9830327

File tree

2 files changed

+15
-17
lines changed

2 files changed

+15
-17
lines changed

ompi/mpi/bindings/c_header.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
# ============================= Constants / Globals ============================
1818
DIR = Path(".")
1919
OUTPUT = DIR / "mpi.h"
20+
INPUT = DIR / "abi.h.in"
2021
JSON_PATH = DIR / "abi.json"
2122

2223
ABI_INTERNAL = "_ABI_INTERNAL"
@@ -69,7 +70,8 @@
6970
# ============================== Argument Parsing ==============================
7071
parser = argparse.ArgumentParser()
7172
parser.add_argument("--abi-json", type=str, help=f"path to ABI JSON file [{DIR}/]")
72-
parser.add_argument("-o", "--output", type=str, help="output directory for the header file")
73+
parser.add_argument("-i", "--input", type=str, help="input path for the .h.in file")
74+
parser.add_argument("-o", "--output", type=str, help="output path for the header file")
7375
parser.add_argument("--mangle-names", help="enable name mangling for constants and datatypes", action="store_true")
7476
parser.add_argument("--no-mangle", help="disable name mangling (default)", action="store_true")
7577

@@ -83,6 +85,8 @@
8385
MANGLE_NAMES = False
8486
if args.output:
8587
OUTPUT = Path(args.output)
88+
if args.input:
89+
INPUT = Path(args.input)
8690

8791
# ================================== Load JSON =================================
8892
with open(JSON_PATH) as f:
@@ -132,7 +136,7 @@ def output_constant(const, use_enum: bool, mangle_name: bool):
132136

133137
# ========================= Manipulate Template Header =========================
134138
lines = []
135-
with open(DIR / "abi.h.in", 'r') as header_in:
139+
with open(INPUT, 'r') as header_in:
136140
lines = header_in.readlines()
137141

138142
# Match lines that start with `$CATEGORY:`. Any amount of whitespace is allowed

ompi/mpi/c/Makefile.am

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -558,27 +558,21 @@ if OMPI_GENERATE_BINDINGS
558558
source \
559559
ompi \
560560
$<
561-
abi.h: $(prototype_sources)
562-
$(OMPI_V_GEN) $(PYTHON) $(top_srcdir)/ompi/mpi/bindings/bindings.py \
563-
--builddir $(abs_top_builddir) \
564-
--srcdir $(abs_top_srcdir) \
565-
--output $@ \
566-
c \
567-
header \
568-
--srcdir $(srcdir) \
569-
$(prototype_sources)
561+
570562
# Non-mangled version
571-
standard_abi/mpi.h: $(top_srcdir)/docs/mpi-standard-apis.json c_header.py
563+
standard_abi/mpi.h: $(top_srcdir)/docs/mpi-standard-apis.json $(top_srcdir)/ompi/mpi/bindings/c_header.py
572564
mkdir -p standard_abi
573-
$(OMPI_V_GEN) $(PYTHON) c_header.py \
574-
--abi-json $(top_srcdir)/docs/mpi-standard-apis.json \
565+
$(OMPI_V_GEN) $(PYTHON) $(top_srcdir)/ompi/mpi/bindings/c_header.py \
566+
--input $(top_srcdir)/ompi/mpi/c/abi.h.in \
567+
--abi-json $(top_srcdir)/docs/mpi-standard-abi.json \
575568
--output $(top_srcdir)/ompi/mpi/c/standard_abi/mpi.h
576569

577570
# Mangled version
578-
abi.h: $(top_srcdir)/docs/mpi-standard-apis.json c_header.py
579-
$(OMPI_V_GEN) $(PYTHON) c_header.py \
571+
abi.h: $(top_srcdir)/docs/mpi-standard-apis.json $(top_srcdir)/ompi/mpi/bindings/c_header.py
572+
$(OMPI_V_GEN) $(PYTHON) $(top_srcdir)/ompi/mpi/bindings/c_header.py \
573+
--input $(top_srcdir)/ompi/mpi/c/abi.h.in \
580574
--output $(top_srcdir)/ompi/mpi/c/abi.h \
581-
--abi-json $(top_srcdir)/docs/mpi-standard-apis.json \
575+
--abi-json $(top_srcdir)/docs/mpi-standard-abi.json \
582576
--mangle-names
583577

584578
%_abi_generated.c: %.c.in

0 commit comments

Comments
 (0)