c-basic/Makefile

55 lines
2.0 KiB
Makefile
Raw Normal View History

2022-11-26 20:07:41 +01:00
#SOURCES = $(wildcard *.c)
#BINARIES = $(SOURCES:%.c=%)
#CFLAGS = -g
#CC = gcc
#
#all: pre $(BINARIES)
#
#pre:
# @mkdir -p bin huffman/bin huffman/testfiles
#
2022-11-26 20:22:19 +01:00
.PHONY = all pre testfiles bigfiles
2022-11-26 20:07:41 +01:00
SOURCES = $(wildcard *.c)
BINARIES = $(SOURCES:%.c=%)
EXECUTABLES= $(addprefix bin/,${BINARIES})
2022-11-26 20:22:19 +01:00
all: pre $(EXECUTABLES) huffman/bin/huffman testfiles
2022-11-26 18:00:11 +01:00
2022-11-26 20:22:19 +01:00
big: all bigfiles
2022-11-26 20:07:41 +01:00
pre:
2022-11-26 20:22:19 +01:00
@mkdir -p bin huffman/bin huffman/testfiles
clean:
2022-11-26 22:48:15 +01:00
rm -rvf bin huffman/testfiles huffman/bin
2022-11-26 20:22:19 +01:00
huffman/bin/huffman: huffman/huffman.c
$(CC) $(CFLAGS) -o $@ $< -lm
testfiles:
@dd if=/dev/urandom of=huffman/testfiles/1K-random.img count=1KiB
@dd if=/dev/urandom of=huffman/testfiles/10K-random.img count=10KiB
@dd if=/dev/urandom of=huffman/testfiles/100K-random.img count=100KiB
@dd if=/dev/urandom of=huffman/testfiles/1M-random.img count=1MiB
@dd if=/dev/urandom of=huffman/testfiles/10M-random.img count=10MiB
@dd if=/dev/zero of=huffman/testfiles/1K-zero.img count=1KiB
@dd if=/dev/zero of=huffman/testfiles/10K-zero.img count=10KiB
@dd if=/dev/zero of=huffman/testfiles/100K-zero.img count=100KiB
@dd if=/dev/zero of=huffman/testfiles/1M-zero.img count=1MiB
@dd if=/dev/zero of=huffman/testfiles/10M-zero.img count=10MiB
@echo -e "Wer\ndas\nliest\nist\ndoof\n" > huffman/testfiles/tiny.txt
@yes 'SAFJALJ AF OIAIFOsdp' | head -c 100KB > huffman/testfiles/small.txt
@yes 'lslfkpoipop iipfiasp' | head -c 1MB > huffman/testfiles/mid.txt
2022-11-26 20:22:19 +01:00
bigfiles:
@dd if=/dev/urandom of=huffman/testfiles/100M-random.img count=100MiB
@dd if=/dev/zero of=huffman/testfiles/100M-zero.img count=100MiB
@dd if=/dev/urandom of=huffman/testfiles/1G-random.img count=1GiB
@dd if=/dev/urandom of=huffman/testfiles/10G-random.img count=10GiB
@dd if=/dev/zero of=huffman/testfiles/1G-zero.img count=1GiB
@dd if=/dev/zero of=huffman/testfiles/10G-zero.img count=10GiB
@yes 'a sla d JK J Kkl' | head -c 100MB > huffman/testfiles/big.txt
@yes ' POP OPO )()( as' | head -c 1G > huffman/testfiles/huge.txt
2022-11-26 18:00:11 +01:00
2022-11-26 20:07:41 +01:00
$(EXECUTABLES): $(SOURCES)
$(CC) $(CFLAGS) -o $@ $< -lm