# Copyright (c) 2023–2024 Emma Tebibyte # Copyright (c) 2023–2024 DTB # Copyright (c) 2023 Sasha Koshka # Copyright (c) 2024 Aaditya Aryal # SPDX-License-Identifier: FSFAP # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice and this # notice are preserved. This file is offered as-is, without any warranty. include ../config.mk .PHONY: bin bin: dj false fop hru intcmp mm npc rpn scrut str strcmp swab true .PHONY: lib # TODO: this does not have to be here .PHONY: prepare prepare: # keep ..$(BUILD)/include until bindgen(1) has stdin support # https://github.com/rust-lang/rust-bindgen/issues/2703 mkdir -p ../$(BUILD)/bin ../$(BUILD)/include ../$(BUILD)/lib mkdir -p ../$(BUILD)/test ../$(BUILD)/o .PHONY: dj dj: ../$(BUILD)/bin/dj ../$(BUILD)/bin/dj: dj/dj.c prepare $(CC) $(CFLAGS) -o $@ dj/dj.c .PHONY: false false: ../$(BUILD)/bin/false ../$(BUILD)/bin/false: false/false.c prepare $(CC) $(CFLAGS) -o $@ false/false.c .PHONY: fop fop: ../$(BUILD)/bin/fop ../$(BUILD)/bin/fop: fop/fop.rs prepare lib $(RUSTC) $(RUSTFLAGS) $(RUSTLIBS) -o $@ fop/fop.rs .PHONY: hru hru: ../$(BUILD)/bin/hru ../$(BUILD)/bin/hru: hru/hru.rs prepare lib $(RUSTC) $(RUSTFLAGS) $(RUSTLIBS) -o $@ hru/hru.rs .PHONY: intcmp intcmp: ../$(BUILD)/bin/intcmp ../$(BUILD)/bin/intcmp: intcmp/intcmp.c prepare $(CC) $(CFLAGS) -o $@ intcmp/intcmp.c .PHONY: mm mm: ../$(BUILD)/bin/mm ../$(BUILD)/bin/mm: mm/mm.c prepare $(CC) $(CFLAGS) -o $@ mm/mm.c .PHONY: npc npc: ../$(BUILD)/bin/npc ../$(BUILD)/bin/npc: npc/npc.c prepare $(CC) $(CFLAGAS) -o $@ npc/npc.c .PHONY: rpn rpn: ../$(BUILD)/bin/rpn ../$(BUILD)/bin/rpn: rpn/rpn.rs prepare lib $(RUSTC) $(RUSTFLAGS) $(RUSTLIBS) -o $@ rpn/rpn.rs .PHONY: scrut scrut: ../$(BUILD)/bin/scrut ../$(BUILD)/bin/scrut: scrut/scrut.c prepare $(CC) $(CFLAGS) -o $@ scrut/scrut.c .PHONY: str str: ../$(BUILD)/bin/str ../$(BUILD)/bin/str: str/str.c prepare $(CC) $(CFLAGS) -o $@ str/str.c .PHONY: strcmp strcmp: ../$(BUILD)/bin/strcmp ../$(BUILD)/bin/strcmp: strcmp/strcmp.c prepare $(CC) $(CFLAGS) -o $@ strcmp/strcmp.c .PHONY: swab swab: ../$(BUILD)/bin/swab ../$(BUILD)/bin/swab: swab/swab.rs prepare lib $(RUSTC) $(RUSTFLAGS) --extern getopt=../$(BUILD)/o/libgetopt.rlib \ --extern sysexits=../$(BUILD)/o/libsysexits.rlib \ -o $@ swab/swab.rs .PHONY: true true: ../$(BUILD)/bin/true ../$(BUILD)/bin/true: true/true.c prepare $(CC) $(CFLAGS) -o $@ true/true.c