File: Makefile

package info (click to toggle)
gd4o 1.0~alpha5-9
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 1,212 kB
  • sloc: xml: 1,618; ml: 1,136; ansic: 781; makefile: 85
file content (107 lines) | stat: -rw-r--r-- 2,374 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
PKGNAME = gd

OCAMLC=ocamlc
OCAMLOPT=ocamlopt
OCAMLMKLIB=ocamlmklib
OCAMLFIND=ocamlfind
OCAMLDOC=ocamldoc -html
OCAMLLIB=`$(OCAMLC) -where`

TASKINSTALL  = $(OCAMLFIND) install $(NAME) $(TASKINSTALLOPTS)

# This turns on some checks that should make the library more secure but
# may degrade performance. If you're more concerned about performance than
# security, comment out the next line.
SAFETY_FLAG = -DSAFER
# If you don't have libjpeg, comment out the 'JPEG_LIB' line.
# Similarly for Freetype2.
JPEG_LIB = -ljpeg
FT2_LIB = -lfreetype
CC=gcc
CINCLUDES=-I$(OCAMLLIB) -I/usr/include 
LIBS=-lgd -lpng -lz $(JPEG_LIB) $(FT2_LIB)
ifdef JPEG_LIB
JPEG_FLAG = -DHAVE_JPEG
endif
ifdef FT2_LIB
FT2_FLAG = -DHAVE_FREETYPE
endif
override CFLAGS += $(CINCLUDES) -fPIC -W -Wall -Wno-unused \
		   $(JPEG_FLAG) $(FT2_FLAG) $(SAFETY_FLAG)

OCAMLCFLAGS=-labels -unsafe
OCAMLOPTFLAGS=-labels -inline 2

BYTE_OBJECTS  = gd.cmi gd.cmo
NAT_OBJECTS = gd.cmi gd.cmx
C_OBJECTS = gdstubs.o
STUBLIBS = dllocamlgd.so libocamlgd.a
BYTE_ARCHIVE  = gd.cma
NAT_ARCHIVE = gd.cmxa


.PHONY : all opt install uninstall test test.opt docs
all : $(BYTE_ARCHIVE)
opt : $(NAT_ARCHIVE)


$(BYTE_ARCHIVE) : $(BYTE_OBJECTS) $(C_OBJECTS)
	$(OCAMLMKLIB) -o gd gd.cmo gdstubs.o -oc ocamlgd $(LIBS)
$(NAT_ARCHIVE) : $(NAT_OBJECTS) $(C_OBJECTS)
	$(OCAMLMKLIB) -o gd gd.cmx gdstubs.o -oc ocamlgd $(LIBS)


gd.cmx: gd.cmi gd.ml
	$(OCAMLOPT) $(OCAMLOPTFLAGS) -c gd.ml

gd.cmo: gd.cmi gd.ml
	$(OCAMLC) $(OCAMLCFLAGS) -c gd.ml

gd.cmi: gd.mli
	$(OCAMLC) $(OCAMLCFLAGS) -c gd.mli


gdstubs.o : gdstubs.c
	$(CC) $(CFLAGS) -c gdstubs.c


test : gdtest
	./gdtest gdtest.log

test.opt : gdtest.opt
	./gdtest.opt gdtest.log

gdtest: gdtest.cmo
	$(OCAMLC) -o gdtest -dllpath . str.cma gd.cma gdtest.cmo 

gdtest.cmo: all gdtest.ml
	$(OCAMLC) $(OCAMLCFLAGS) -c gdtest.ml

gdtest.opt: gdtest.cmx
	$(OCAMLOPT) -ccopt "-L ." -o gdtest.opt str.cmxa gd.cmxa gdtest.cmx

gdtest.cmx: opt gdtest.ml
	$(OCAMLOPT) $(OCAMLOPTFLAGS) -c gdtest.ml 


docs : gd.mli
	$(OCAMLDOC) -d doc gd.mli


install :
	files=$$( \
		for f in $(BYTE_ARCHIVE) $(NAT_ARCHIVE) $(STUBLIBS) \
			*.mli *.cmi gd.a META; do \
			if [ -f "$$f" ]; then echo $$f; fi; \
		done; \
	) && \
	$(TASKINSTALL) $(PKGNAME) $$files


uninstall :
	 ocamlfind remove $(PKGNAME)


clean :
	 -rm -f *.cmi *.cmo *.cmx *.cma *.cmxa *.a *.o *.so \
	   gdtest gdtest.opt gdtest.log