# Generate test fixtures (.o files, archives, small binary blobs, data
# descriptions) used by the elf_tools test suite.  Run "make" from inside
# tests/data/ to regenerate fixtures from scratch.

CFLAGS := -std=c17 -Wall -O0 -c

all: hello.o math.o lib.a small.bin empty.bin medium.bin

# A simple translation unit that defines and references libc symbols.
hello.o: hello.c
	$(CC) $(CFLAGS) -o $@ $<

math.o: math.c
	$(CC) $(CFLAGS) -o $@ $<

# Archive containing two members for ar-iteration tests.
lib.a: hello.o math.o
	ar rcs $@ hello.o math.o

# Tiny known-content binary for bin2obj tests.
small.bin:
	printf 'hello world\n' > $@

# Zero-length file (edge case).
empty.bin:
	: > $@

# 1024-byte fixed-pattern binary.
medium.bin:
	dd if=/dev/zero bs=1 count=1024 status=none | tr '\0' 'A' > $@

clean:
	rm -f *.o *.a small.bin empty.bin medium.bin
