Commit 00f04ebb authored by Renaud Pacalet's avatar Renaud Pacalet
Browse files

Complete new Makefile

parent 5cd934e1
......@@ -124,15 +124,23 @@ DECMETHOD := scmsfp2 16 8
SEED := 19
GENMETHOD := dense
export V T CHANNEL DECMETHOD SEED GENMETHOD
channel := $(subst $(SPACE),_,$(CHANNEL))
decmethod := $(subst $(SPACE),_,$(DECMETHOD))
# All standard tests
# Tests
.PHONY: test-all
.PHONY: test test-all
# Defaults for single test
STANDARD := 802.11n
Z := 27
M := 12
N := 24
CODE := $(STANDARD)_$(Z)_$(M)_$(N)
D := $(shell printf '%d' "$$(( $(Z) * $(N) - $(Z) * $(M)))")
TEST := $(BUILDDIR)/$(SEED)_$(D)_$(CODE)_$(channel)_$(decmethod).test
# 3GPP lifting factors
3GPPZVALUES := 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 18 20 22 24 26 28 30 32 36 40 44 48 52 56 60 64 72 80 88 96 104 112 120 128 144 160 176 192 208 224 240 256 288 320 352 384
%.pchk: %.qc | $(QCTOPCHK)
......@@ -147,13 +155,25 @@ $(BUILDDIR)/$(SEED)_%.src: | $(RANDSRC)
%_$(channel).rec: %.enc | $(TRANSMIT)
$(AT)$(TRANSMIT) $< $@ $(SEED) $(CHANNEL) $(DEVNULL)
%.test: %.done
@echo '$@: $<'
# $(1..4): STANDARD, Z, M, N
# $(1)...$(5): FILE, STANDARD, Z, M, N
# if FILE is non-empty, STANDARD, Z, M, N are ignored and the FILE is used as
# code definition.
define TEST_rule
d := $$(shell printf '%d' "$$$$(( $(4) * $(2) - $(3) * $(2)))")
code := $(1)_$(2)_$(3)_$(4)
ifneq ($(1),)
zmn := $$(shell head -1 $(1))
standard := $$(basename $$(notdir $(1)))
z := $$(word 1,$$(zmn))
m := $$(word 2,$$(zmn))
n := $$(word 3,$$(zmn))
else
standard := $(2)
z := $(3)
m := $(4)
n := $(5)
endif
code := $$(standard)_$$(z)_$$(m)_$$(n)
d := $$(shell printf '%d' "$$$$(( $$(z) * $$(n) - $$(z) * $$(m)))")
qc := $$(BUILDDIR)/$$(code).qc
pchk := $$(BUILDDIR)/$$(code).pchk
gen := $$(BUILDDIR)/$$(code).gen
......@@ -166,72 +186,44 @@ test := $$(BUILDDIR)/$$(SEED)_$$(d)_$$(code)_$$(channel)_$$(decmethod).test
.PRECIOUS: $$(qc) $$(pchk) $$(gen) $$(src) $$(enc) $$(rec) $$(dec) $$(done)
.PHONY: $$(test)
ifneq ($(1),)
$$(qc): $(1)
$$(AT)cp -f $$< $$@
$$(qc): | $$(MAKEQC)
$$(AT)$$(MAKEQC) --standard="$(1)" --lifting=$(2) --brows=$(3) --bcols=$(4) $$@
TEST := $$(BUILDDIR)/$$(SEED)_$$(d)_$$(code)_$$(channel)_$$(decmethod).test
else
$$(qc): STANDARD := "$$(standard)"
$$(qc): Z :="$$(z)"
$$(qc): M := "$$(m)"
$$(qc): N := "$$(n)"
$$(enc): $$(src) $$(pchk) $$(gen) | $$(ENCODE)
$$(AT)$$(ENCODE) $$(pchk) $$(gen) $$< $$@ $$(DEVNULL)
$$(qc): | $$(MAKEQC)
$$(AT)$$(MAKEQC) --standard="$$(STANDARD)" --lifting=$$(Z) --brows=$$(M) --bcols=$$(N) $$@
endif
$$(BUILDDIR)/$$(SEED)_$$(d)_$$(code)_$$(channel)_$$(decmethod).%: $$(rec) $$(pchk) | $$(DECODE)
$$(AT)r=$$$$($$(DECODE) $$(pchk) $$< $$(dec) $$(CHANNEL) $$(DECMETHOD) 2>&1) && \
printf '%s:\t%s\n' '$$@' "$$$$r" > $$(done)
$$(enc): $$(pchk) $$(gen) $$(src) | $$(ENCODE)
$$(AT)$$(ENCODE) $$^ $$@ $$(DEVNULL)
test-all: $$(test)
endef
$(foreach z,27 54 81,$(foreach m,4 6 8 12,$(eval $(call TEST_rule,802.11n,$(z),$(m),24))))
$(foreach z,$(3GPPZVALUES),$(eval $(call TEST_rule,3GPP,$(z),46,68)))
$(foreach z,$(3GPPZVALUES),$(eval $(call TEST_rule,3GPP,$(z),42,52)))
$$(BUILDDIR)/$$(SEED)_$$(d)_$$(code)_$$(channel)_$$(decmethod).d%: $$(pchk) $$(rec) | $$(DECODE)
$$(AT)printf '$$(basename $$@): ' > $$(basename $$@).done
$$(AT)$$(DECODE) $$^ $$(basename $$@).dec $$(CHANNEL) $$(DECMETHOD) 2>> $$(basename $$@).done
# Single test
.PHONY: $$(test)
.PHONY: test
$$(test): $$(done)
@cat $$<
STANDARD := 802.11n
Z := 27
M := 12
N := 24
test-all: $$(test)
endef
$(foreach z,27 54 81,$(foreach m,4 6 8 12,$(eval $(call TEST_rule,,802.11n,$(z),$(m),24))))
$(foreach z,$(3GPPZVALUES),$(eval $(call TEST_rule,,3GPP,$(z),46,68)))
$(foreach z,$(3GPPZVALUES),$(eval $(call TEST_rule,,3GPP,$(z),42,52)))
ifneq ($(QCMATRIX),)
ZMN := $(shell head -1 $(QCMATRIX))
Z := $(word 1,$(ZMN))
M := $(word 2,$(ZMN))
N := $(word 3,$(ZMN))
D := $(shell printf '%d' "$$(( $(Z) * $(N) - $(Z) * $(M)))")
CODE := $(basename $(notdir $(QCMATRIX)))
QC := $(BUILDDIR)/$(CODE).qc
PCHK := $(BUILDDIR)/$(CODE).pchk
GEN := $(BUILDDIR)/$(CODE).gen
SRC := $(BUILDDIR)/$(SEED)_$(D).src
ENC := $(BUILDDIR)/$(SEED)_$(D)_$(CODE).enc
REC := $(BUILDDIR)/$(SEED)_$(D)_$(CODE)_$(channel).rec
DEC := $(BUILDDIR)/$(SEED)_$(D)_$(CODE)_$(channel)_$(decmethod).dec
DONE := $(BUILDDIR)/$(SEED)_$(D)_$(CODE)_$(channel)_$(decmethod).done
TEST := $(BUILDDIR)/$(SEED)_$(D)_$(CODE)_$(channel)_$(decmethod).test
.PRECIOUS: $(QC) $(PCHK) $(GEN) $(SRC) $(ENC) $(REC) $(DEC) $(DONE)
.PHONY: $(TEST)
$(QC): $(QCMATRIX)
$(AT)cp -f $< $@
$(ENC): $(SRC) $(PCHK) $(GEN) | $(ENCODE)
$(AT)$(ENCODE) $(PCHK) $(GEN) $< $@ $(DEVNULL)
$(BUILDDIR)/$(SEED)_$(D)_$(CODE)_$(channel)_$(decmethod).%: $(REC) $(PCHK) | $(DECODE)
$(AT)r=$$($(DECODE) $(PCHK) $< $(DEC) $(CHANNEL) $(DECMETHOD) 2>&1) && \
printf '%s:\t%s\n' '$@' "$$r" > $(DONE)
$(eval $(call TEST_rule,$(QCMATRIX),,,,))
endif
test: $(TEST)
else
D := $(shell printf '%d' "$$(( $(Z) * $(N) - $(Z) * $(M)))")
CODE := $(STANDARD)_$(Z)_$(M)_$(N)
test: $(BUILDDIR)/$(SEED)_$(D)_$(CODE)_$(channel)_$(decmethod).test
@echo $^
endif
test-clean:
rm -f $(addprefix $(BUILDDIR)/,*.qc *.pchk *.gen *.src *.dec *.enc *.rec *.done)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment