diff --git a/assets/Amiga2000.png b/assets/Amiga2000.png new file mode 100644 index 0000000..200800f Binary files /dev/null and b/assets/Amiga2000.png differ diff --git a/shared/tools.mk b/shared/tools.mk new file mode 100644 index 0000000..b5db461 --- /dev/null +++ b/shared/tools.mk @@ -0,0 +1,24 @@ +WARN_ERROR=-Werror +HOST_WARNINGS=$(WARN_ERROR) -pedantic-errors -Wfatal-errors -Wall -Wextra -Wno-unused-parameter -Wshadow -limagequant +HOST_CFLAGS=$(HOST_WARNINGS) -O3 $(EXTRA_CFLAGS) + +$(PROGRAM): out bin $(OBJS) + gcc $(OBJS) -o $(PROGRAM) $(LIBS) + +-include $(OBJS:.o=.d) + +out/%.o: %.c + gcc -c $(HOST_CFLAGS) $< -o $@ + @gcc -MM $(HOST_CFLAGS) $*.c > out/$*.d + @mv -f out/$*.d out/$*.d.tmp + @sed 's/^.*\:/out\/&/' < out/$*.d.tmp > out/$*.d + @rm -f out/$*.d.tmp + +out: + mkdir out + +bin: + mkdir bin + +clean: + rm -rf out bin *~ diff --git a/tools/imagecon/Makefile b/tools/imagecon/Makefile index fcff735..6fd8355 100644 --- a/tools/imagecon/Makefile +++ b/tools/imagecon/Makefile @@ -1,8 +1,5 @@ -IMAGECON=./out/imagecon +PROGRAM=./out/imagecon OBJS=out/imagecon.o out/png.o out/color.o out/dither.o out/ham.o out/palette.o out/file.o out/sliced_ham.o out/quant.o out/utils.o -WARN_ERROR=-Werror -HOST_WARNINGS=$(WARN_ERROR) -pedantic-errors -Wfatal-errors -Wall -Wextra -Wno-unused-parameter -Wshadow -limagequant -HOST_CFLAGS=$(HOST_WARNINGS) -O3 LIBS=-lpng -limagequant # test stuff @@ -30,47 +27,31 @@ DITHERED_HAM_IMAGE=../../assets/gigi.png DITHERED_HAM_BASE=out/dithered_ham REFERENCE_DITHERED_HAM_BASE=reference/dithered_ham -$(IMAGECON): out bin $(OBJS) - gcc $(OBJS) -o $(IMAGECON) $(LIBS) - --include $(OBJS:.o=.d) - -out/%.o: %.c - gcc -c $(HOST_CFLAGS) $< -o $@ - @gcc -MM $(HOST_CFLAGS) $*.c > out/$*.d - @mv -f out/$*.d out/$*.d.tmp - @sed 's/^.*\:/out\/&/' < out/$*.d.tmp > out/$*.d - @rm -f out/$*.d.tmp - -out: - mkdir out - -bin: - mkdir bin +include ../../shared/tools.mk $(USED_PALETTE): $(SHARED_PALETTE) @echo "testing use-palette" - $(IMAGECON) --input $(TEST_IMAGE),$(BOB_IMAGE) --output $(SHARED_BASE) --use-palette $(SHARED_PALETTE) --output-bitplanes --output-copperlist + $(PROGRAM) --input $(TEST_IMAGE),$(BOB_IMAGE) --output $(SHARED_BASE) --use-palette $(SHARED_PALETTE) --output-bitplanes --output-copperlist -$(SHARED_PALETTE): $(IMAGECON) +$(SHARED_PALETTE): $(PROGRAM) -rm -f $(SHARED_PALETTE) - $(IMAGECON) --input $(TEST_IMAGE),$(BOB_IMAGE) --output $(SHARED_BASE) --colors 32 --quantize --output-palette + $(PROGRAM) --input $(TEST_IMAGE),$(BOB_IMAGE) --output $(SHARED_BASE) --colors 32 --quantize --output-palette -$(OUTPUT_BASE).bin: $(IMAGECON) +$(OUTPUT_BASE).bin: $(PROGRAM) -rm -f $(OUTPUT_BASE).bin $(OUTPUT_BASE)-copper-list.s $(OUTPUT_BASE)-palette.s - $(IMAGECON) --input $(TEST_IMAGE) --output $(OUTPUT_BASE) --output-copperlist --output-bitplanes --output-grey-palette --output-palette-asm --colors 32 --quantize - $(IMAGECON) --input $(BOB_IMAGE) --output $(BOB_BASE) --output-mask --colors 32 --quantize + $(PROGRAM) --input $(TEST_IMAGE) --output $(OUTPUT_BASE) --output-copperlist --output-bitplanes --output-grey-palette --output-palette-asm --colors 32 --quantize + $(PROGRAM) --input $(BOB_IMAGE) --output $(BOB_BASE) --output-mask --colors 32 --quantize $(EHB_BASE).bin: $(EHB_IMAGE) - $(IMAGECON) --input $(EHB_IMAGE) --output $(EHB_BASE) --output-bitplanes --colors 32 --quantize --extra-half-brite --output-copperlist + $(PROGRAM) --input $(EHB_IMAGE) --output $(EHB_BASE) --output-bitplanes --colors 32 --quantize --extra-half-brite --output-copperlist $(HAM_BASE).bin: $(HAM_IMAGE) - $(IMAGECON) --input $(HAM_IMAGE) --output $(HAM_BASE) --output-bitplanes --ham --output-palette-asm + $(PROGRAM) --input $(HAM_IMAGE) --output $(HAM_BASE) --output-bitplanes --ham --output-palette-asm $(DITHERED_HAM_BASE).bin: $(DITHERED_HAM_IMAGE) - $(IMAGECON) --input $(DITHERED_HAM_IMAGE) --output $(DITHERED_HAM_BASE) --dither --output-bitplanes --ham --output-palette-asm + $(PROGRAM) --input $(DITHERED_HAM_IMAGE) --output $(DITHERED_HAM_BASE) --dither --output-bitplanes --ham --output-palette-asm -test: $(IMAGECON) $(OUTPUT_BASE).bin $(SHARED_PALETTE) $(USED_PALETTE) $(EHB_BASE).bin $(HAM_BASE).bin $(DITHERED_HAM_BASE).bin +test: $(PROGRAM) $(OUTPUT_BASE).bin $(SHARED_PALETTE) $(USED_PALETTE) $(EHB_BASE).bin $(HAM_BASE).bin $(DITHERED_HAM_BASE).bin diff $(OUTPUT_BASE).bin $(REFERENCE_BASE).bin diff $(OUTPUT_BASE)-copper-list.s $(REFERENCE_BASE)-copper-list.s diff $(OUTPUT_BASE)-palette.s $(REFERENCE_BASE)-palette.s @@ -92,6 +73,3 @@ test: $(IMAGECON) $(OUTPUT_BASE).bin $(SHARED_PALETTE) $(USED_PALETTE) $(EHB_BAS @echo "| __/| _ | \`--. \\\`--. \ __|| | | | " @echo "| | | | | |/\__/ /\__/ / |___| |/ / " @echo "\_| \_| |_/\____/\____/\____/|___/ " - -clean: - rm -rf out bin *~ \ No newline at end of file diff --git a/tools/makeadf/Makefile b/tools/makeadf/Makefile index 6bade6c..83b2e1d 100644 --- a/tools/makeadf/Makefile +++ b/tools/makeadf/Makefile @@ -1,22 +1,10 @@ -MAKEADF=./out/makeadf -SRCS=makeadf.c -HOST_WARNINGS=-pedantic-errors -Wfatal-errors -Wall -Werror -Wextra -Wno-unused-parameter -Wshadow -HOST_CFLAGS=$(HOST_WARNINGS) +PROGRAM=./out/makeadf +OBJS=./out/makeadf.o -$(MAKEADF): out bin $(SRCS) - gcc $(HOST_CFLAGS) $(SRCS) -o $(MAKEADF) +include ../../shared/tools.mk -out: - mkdir out - -bin: - mkdir bin - -clean: - rm -r out bin *~ - -test: $(MAKEADF) - $(MAKEADF) reference/bootblock.bin > out/test.adf +test: $(PROGRAM) + $(PROGRAM) reference/bootblock.bin > out/test.adf diff reference/test.adf out/test.adf @echo "______ ___ _____ _____ ___________ " @echo "| ___ \/ _ \ / ___/ ___| ___| _ \ " diff --git a/tools/resize/Makefile b/tools/resize/Makefile index 6b33283..7e3efdb 100644 --- a/tools/resize/Makefile +++ b/tools/resize/Makefile @@ -1,9 +1,9 @@ PROGRAM=./out/resize OBJS=out/resize.o -WARN_ERROR=-Werror -HOST_WARNINGS=$(WARN_ERROR) -pedantic-errors -Wfatal-errors -Wall -Wextra -Wno-unused-parameter -Wshadow -limagequant -HOST_CFLAGS=$(HOST_WARNINGS) -O3 `GraphicsMagick-config --cppflags` LIBS=`GraphicsMagick-config --ldflags --libs` +EXTRA_CFLAGS=`GraphicsMagick-config --cppflags` + +include ../../shared/tools.mk TEST_IMAGE=../../assets/gigi_full.png RESIZED_IMAGE=out/gigi.png @@ -11,36 +11,31 @@ RESIZED_LACED=out/gigi_laced.png REFERENCE_IMAGE=reference/gigi.png REFERENCE_LACED=reference/gigi_laced.png -$(PROGRAM): out bin $(OBJS) - gcc $(OBJS) -o $(PROGRAM) $(LIBS) +TEST_IMAGE2=../../assets/Amiga2000.png +RESIZED_IMAGE2=out/Amiga2000.png +REFERENCE_IMAGE2=reference/Amiga2000.png +RESIZED_LACED2=out/Amiga2000_laced.png +REFERENCE_LACED2=reference/Amiga2000_laced.png --include $(OBJS:.o=.d) -out/%.o: %.c - gcc -c $(HOST_CFLAGS) $< -o $@ - @gcc -MM $(HOST_CFLAGS) $*.c > out/$*.d - @mv -f out/$*.d out/$*.d.tmp - @sed 's/^.*\:/out\/&/' < out/$*.d.tmp > out/$*.d - @rm -f out/$*.d.tmp - -out: - mkdir out - -bin: - mkdir bin - -clean: - rm -rf out bin *~ $(RESIZED_IMAGE): $(TEST_IMAGE) $(PROGRAM) Makefile $(PROGRAM) --width=320 --height=256 --blur=0.75 --input=$(TEST_IMAGE) --output=$(RESIZED_IMAGE) +$(RESIZED_IMAGE2): $(TEST_IMAGE2) $(PROGRAM) Makefile + $(PROGRAM) --width=320 --height=256 --blur=0.75 --input=$(TEST_IMAGE2) --output=$(RESIZED_IMAGE2) + $(RESIZED_LACED): $(TEST_IMAGE) $(PROGRAM) Makefile $(PROGRAM) --width=320 --height=512 --interlaced --blur=0.75 --input=$(TEST_IMAGE) --output=$(RESIZED_LACED) -test: $(RESIZED_IMAGE) $(RESIZED_LACED) +$(RESIZED_LACED2): $(TEST_IMAGE2) $(PROGRAM) Makefile + $(PROGRAM) --width=320 --height=512 --interlaced --blur=0.75 --input=$(TEST_IMAGE2) --output=$(RESIZED_LACED2) + +test: $(RESIZED_IMAGE) $(RESIZED_LACED) $(RESIZED_IMAGE2) $(RESIZED_LACED2) diff $(RESIZED_IMAGE) $(REFERENCE_IMAGE) diff $(RESIZED_LACED) $(REFERENCE_LACED) + diff $(RESIZED_IMAGE2) $(REFERENCE_IMAGE2) + diff $(RESIZED_LACED2) $(REFERENCE_LACED2) @echo "______ ___ _____ _____ ___________ " @echo "| ___ \/ _ \ / ___/ ___| ___| _ \ " @echo "| |_/ / /_\ \\\\\ \`--.\ \`--.| |__ | | | | "