example: add example from Section 2.4.5 of documentation
[piplib.git] / example / Makefile
blobf3ebbae0e3948801e45474db348af0dc04fd83bd
1 # Please enter here the locations for PipLib include and libraries if they
2 # aren't the default values (/usr/lib and /usr/include).
3 PIPLIB_INC = $(HOME)/progs/linux/include
4 PIPLIB_LIB = $(HOME)/progs/linux/lib
6 CC = gcc
7 LDLIBS= -lpiplib32
8 CFLAGS= -DLINEAR_VALUE_IS_INT -I $(PIPLIB_INC) -L $(PIPLIB_LIB)
10 ROOT = ..
12 PIPTEST = \
13 big \
14 boulet \
15 brisebarre \
16 cg1 \
17 esced \
18 ex \
19 ex2 \
20 fimmel \
21 max \
22 negative \
23 small \
24 sor1d \
25 square \
26 sven
28 BITS = 64
30 example: example.c
31 @echo " /*-----------------------------------------------*"
32 @echo " * Making example *"
33 @echo " *-----------------------------------------------*/"
34 $(CC) example.c -o example $(CFLAGS) $(LDLIBS)
36 pip:
37 $(MAKE) total -C ../
39 clean:
40 @echo " /*-----------------------------------------------*"
41 @echo " * Cleaning example *"
42 @echo " *-----------------------------------------------*/"
43 -rm -f example example.exe core
45 test:
46 failedtest=0; \
47 for x in $(PIPTEST) ; do \
48 echo "Verify file $$x" ; \
49 $(ROOT)/obj$(BITS)_$(TARGET)/example$(BITS)$(EXEC_SUFFIX) < $$x.pip > xyz ;\
50 diff -w xyz $$x.ll ; \
51 result=$$?; \
52 if [ "$$result" -eq "1" ]; then \
53 echo "Error: $$x is not the same"; \
54 failedtest=`expr $$failedtest + 1`; \
55 else \
56 echo "$$x passed"; \
57 fi; \
58 done ; \
59 rm xyz ; \
60 if [ $$failedtest != 0 ]; then \
61 echo "$$failedtest tests failed"; \
62 else \
63 echo "PIP works correctly :-)"; \
66 # Include the shared compilation rules
67 include $(ROOT)/Makefile