File tree Expand file tree Collapse file tree 3 files changed +17
-15
lines changed
Expand file tree Collapse file tree 3 files changed +17
-15
lines changed Original file line number Diff line number Diff line change @@ -2,16 +2,27 @@ images_names=kodim01.png kodim02.png
22
33all : split
44images :$(addprefix testImage/,$(images_names ) )
5+ .PHONY : clean test
56
7+ BINS =split tests/createBlankImage
68OBJ: =split.o lib/fillwithblack.o lib/manppm.o
79EXTRACFLAGS =
810CFLAGS =-Wall $(EXTRACFLAGS )
911
12+ $(BINS ) :
13+ $(CC ) $(CFLAGS ) -lm -o $@ $^
14+
1015split : $(OBJ )
11- $(CC ) $(CFLAGS ) -lm $(OBJ ) -o $@
16+ tests/createBlankImage : tests/createBlankImage.o lib/fillwithblack.o lib/manppm.o
17+
1218
1319testImage/kodim% .png :
1420 wget --quiet http://r0k.us/graphics/kodak/kodak/$(notdir $@ ) -O $@
1521
1622clean :
17- rm -f $(OBJ ) split
23+ rm -f $(OBJ ) split tests/createBlankImage
24+
25+
26+
27+ test : tests/cuttest tests/createBlankImage split
28+ cd $(dir $< ) && bash $(notdir $< )
Original file line number Diff line number Diff line change 11#include <stdio.h>
22#include <stdlib.h>
33#include <string.h>
4+ #include <math.h>
45#include "fillwithblack.h"
56
67void writePPM (const char * filename , PPMImage * img ) {
Original file line number Diff line number Diff line change @@ -12,12 +12,8 @@ function genLine {
1212 tanalpha=$sign $( printf " 0.%03d%02d" $(( $RANDOM % 1000 )) $(( $RANDOM % 100 )) )
1313}
1414
15- function initFuncs {
16- gcc -o createBlankImg ../lib/manppm.c ../lib/fillwithblack.c createBlankImage.c -lm 2> /dev/null
17- }
18-
1915function createVoidImage {
20- ./createBlankImg -n " voidImage.ppm"
16+ ./createBlankImage -n " voidImage.ppm"
2117}
2218
2319function cleanVoidImage {
@@ -40,7 +36,7 @@ function testRandomPoints {
4036 y2=` shuf -i $halfheight -$height -n 1`
4137 x1=` echo " $intercept +$tanalpha *$y1 " | bc`
4238 x2=` echo " $intercept +$tanalpha *$y2 " | bc`
43- ./createBlankImg -n " blankImage.ppm" -x $x1 -y $y1 -a $x2 -b $y2
39+ ./createBlankImage -n " blankImage.ppm" -x $x1 -y $y1 -a $x2 -b $y2
4440 ../split -f " blankImage.ppm" -p -s
4541}
4642
@@ -50,9 +46,6 @@ function testRandomPoints {
5046# echo $intercept
5147# echo $tanalpha
5248
53- # Init stuff #
54-
55- initFuncs
5649
5750# Void Image test #
5851
@@ -71,13 +64,10 @@ testRandomPoints
7164# echo $y2
7265echo " intercept: " $intercept
7366echo " tanalpha: " $tanalpha
74- rm blankImage.ppm
67+ rm -f blankImage.ppm
7568
7669# Clean All #
7770
78- rm ../lib/fillwithblack.o ../lib/manppm.o
79- rm ./createBlankImg
80-
8171# ##################
8272
8373
You can’t perform that action at this time.
0 commit comments