File: Makefile

package info (click to toggle)
ocsigenserver 2.16.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 2,480 kB
  • sloc: ml: 12,965; makefile: 807; sh: 622
file content (175 lines) | stat: -rw-r--r-- 6,062 bytes parent folder | download
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
include ../Makefile.config

all: metas confs
	${MAKE} -C baselib all
	${MAKE} -C http all
	${MAKE} -C server all
	${MAKE} -C extensions all

byte: metas confs
	${MAKE} -C baselib byte
	${MAKE} -C http byte
	${MAKE} -C server byte
	${MAKE} -C extensions byte

opt: metas confs
	${MAKE} -C baselib opt
	${MAKE} -C http opt
	${MAKE} -C server opt
	${MAKE} -C extensions opt

### META ###

metas: files/META files/META.${PROJECTNAME}

files/META: files/META.in ../Makefile.config ../Makefile.options Makefile
	cat $< \
	  | sed s/%%CAMLZIPNAME%%/$(CAMLZIPNAME)/ \
	  | sed s/%%NAME%%/$(PROJECTNAME)/g \
	  | sed s/%%DEPS%%/$(shell ${OCAMLFIND} query -p-format -separator ',' ${SERVER_PACKAGE})/g \
	  | sed s/%%BASEDEPS%%/$(shell ${OCAMLFIND} query -p-format -separator ',' ${BASE_PACKAGE})/g \
	  > $@

files/META.${PROJECTNAME}: files/META.in ../Makefile.config ../Makefile.options Makefile
	echo directory = \"../server\" > $@
	cat $< \
	  | sed s/%%CAMLZIPNAME%%/$(CAMLZIPNAME)/ \
	  | sed s/%%NAME%%/$(PROJECTNAME)/g \
	  | sed s/%%DEPS%%/$(shell ${OCAMLFIND} query -p-format -separator ',' ${SERVER_PACKAGE})/g \
	  | sed s/%%BASEDEPS%%/$(shell ${OCAMLFIND} query -p-format -separator ',' ${BASE_PACKAGE})/g \
	  | sed "s%package \"\(polytables\|commandline\|baselib\)\" (%package \"\1\" (\n  directory = \"../baselib\"%" \
	  | sed "s%package \"\(http\|cookies\)\" (%package \"\1\" (\n  directory = \"../http\"%" \
	  | sed "s%directory = \"extensions\"%directory = \"../extensions\"%" \
	  >> $@

### CONF ####

confs: ../$(PROJECTNAME).conf.sample ../local/etc/${PROJECTNAME}.conf

../$(PROJECTNAME).conf.sample: files/$(PROJECTNAME).conf.in ../Makefile.config Makefile
	cat $< \
	  | sed s%_LOGDIR_%$(LOGDIR)%g \
	  | sed s%_DATADIR_%$(DATADIR)%g \
	  | sed s%_OCSIGENUSER_%$(OCSIGENUSER)%g \
	  | sed s%_OCSIGENGROUP_%"$(OCSIGENGROUP)"%g \
	  | sed s%_COMMANDPIPE_%$(COMMANDPIPE)%g \
	  | sed s%_MIMEFILE_%$(CONFIGDIR)/mime.types%g \
	  | sed s%_METADIR_%$(LIBDIR)%g \
	  | sed s%_PROJECTNAME_%$(PROJECTNAME)%g \
	  | sed s%_LIBDIR_%$(LIBDIR)%g \
	  | sed s%_EXTDIR_%$(LIBDIR)/ocsigenserver/extensions%g \
	  | sed s%_CONFIGDIR_%$(CONFIGDIR)%g \
	  | sed s%_STATICPAGESDIR_%$(STATICPAGESDIR)%g \
	  | sed s%_EXTPACKAGENAME_%$(PROJECTNAME).ext%g \
	  > $@

../local/etc/$(PROJECTNAME).conf: files/${PROJECTNAME}.conf.in ../Makefile.config Makefile
	mkdir -p ../local/etc ../local/var/log ../local/var/run
	cat $< \
	  | sed s%80\</port\>%8080\</port\>%g \
	  | sed s%_LOGDIR_%$(SRC)/local/var/log%g \
	  | sed s%_DATADIR_%$(SRC)/local/var/lib%g \
	  | sed s%\<user\>_OCSIGENUSER_\</user\>%%g \
	  | sed s%\<group\>_OCSIGENGROUP_\</group\>%%g \
	  | sed s%_COMMANDPIPE_%$(SRC)/local/var/run/${PROJECTNAME}_command%g \
	  | sed s%_MIMEFILE_%$(SRC)/src/files/mime.types%g \
	  | sed s%_METADIR_%${LIBDIR}\"/\>\<findlib\ path=\"$(SRC)/src/files/\"/\>\<findlib\ path=\"$(SRC)/src/extensions/files/%g \
	  | sed s%_PROJECTNAME_%$(PROJECTNAME)%g \
	  | sed s%_EXTLIBDIR_%${SRC}/src/extensions/ocsipersist-dbm%g \
	  | sed s%_CONFIGDIR_%$(SRC)/local/etc%g \
	  | sed s%_STATICPAGESDIR_%$(SRC)/local/var/www%g \
	  | sed s%_EXTPACKAGENAME_%$(PROJECTNAME).ext%g \
	  | sed s%\<\!--\ \<commandpipe%\<commandpipe%g \
	  | sed s%\</commandpipe\>\ --\>%\</commandpipe\>%g \
	  | sed s%\<\!--\ \<mimefile%\<mimefile%g \
	  | sed s%\</mimefile\>\ --\>%\</mimefile\>%g \
	  | sed s%store\ dir=\"$(SRC)/var/lib\"%store\ dir=\"$(SRC)/local/var/lib/ocsipersist\"%g \
	  > $@


### Install ###

include Makefile.filelist

VERSION := $(shell head -n 1 ../VERSION)

install: INSTALL_BIN=$(BIN) $(NATBIN)
install: INSTALL_IMPL=$(IMPL) $(NATIMPL)
install: INSTALL_PLUGINS_IMPL=$(PLUGINS_IMPL) $(PLUGINS_NATIMPL)
install: INSTALL_PLUGINS_BIN=$(PLUGINS_BIN) $(PLUGINS_NATBIN)
install: raw_install

install.byte: INSTALL_BIN=$(BIN)
install.byte: INSTALL_IMPL=$(IMPL)
install.byte: INSTALL_PLUGINS_IMPL=$(PLUGINS_IMPL)
install.byte: INSTALL_PLUGINS_BIN=$(PLUGINS_BIN)
install.byte: raw_install

install.opt: INSTALL_BIN=$(NATBIN)
install.opt: INSTALL_IMPL=$(NATIMPL)
install.opt: INSTALL_PLUGINS_IMPL=$(PLUGINS_NATIMPL)
install.opt: INSTALL_PLUGINS_BIN=$(PLUGINS_NATBIN)
install.opt: raw_install

raw_install:
	 # Server binaries
	$(INSTALL) -m 755 -d $(TEMPROOT)$(BINDIR)
	$(INSTALL) -m 755 $(INSTALL_BIN) $(TEMPROOT)$(BINDIR)/
	 # Server libraries
	$(INSTALL) -m 755 -d $(TEMPROOT)$(LIBDIR)
	$(OCAMLFIND) install $(PROJECTNAME) \
	   -destdir $(TEMPROOT)$(LIBDIR) \
	   -patch-version ${VERSION} \
	   ${INTF} $(wildcard ${INTF_CMX}) $(INSTALL_IMPL) $(DOC) files/META
	 # Extensions
	$(INSTALL) -m 755 -d $(TEMPROOT)${LIBDIR}/${PROJECTNAME}/extensions/
	$(INSTALL) -m 644 \
	  $(PLUGINS_INTF) $(INSTALL_PLUGINS_IMPL) $(PLUGINS_DOC) \
	  $(TEMPROOT)${LIBDIR}/${PROJECTNAME}/extensions/
	[ -z "$(strip ${INSTALL_PLUGINS_BIN})" ] || \
	  $(INSTALL) -m 755 $(INSTALL_PLUGINS_BIN) \
	  $(TEMPROOT)${LIBDIR}/${PROJECTNAME}/extensions/

uninstall:
	 # Extensions
	-rm -r $(TEMPROOT)${LIBDIR}/${PROJECTNAME}/extensions/
	 # Server libraries
	-$(OCAMLFIND) remove ${PROJECTNAME} -destdir $(TEMPROOT)${LIBDIR}
	 # Server binaries
	-rm -r $(addprefix $(TEMPROOT)$(BINDIR)/,$(notdir ${BIN} ${NATBIN}))
	-rmdir --ignore-fail-on-non-empty $(TEMPROOT)$(BINDIR)

reinstall: uninstall install

###

clean: clean.local
	${MAKE} -C baselib clean
	${MAKE} -C http clean
	${MAKE} -C server clean
	${MAKE} -C extensions clean

clean.local:
	-rm -f ../${PROJECTNAME}.conf.sample
	-rm -f ../${PROJECTNAME}.conf.opt.sample
	-rm -f ../${PROJECTNAME}.conf.local
	-rm -f ../${PROJECTNAME}.conf.opt.local
	-rm -f files/META files/META.${PROJECTNAME}

distclean: clean.local
	${MAKE} -C baselib distclean
	${MAKE} -C http distclean
	${MAKE} -C server distclean
	${MAKE} -C extensions distclean
	-rm -f *~ \#* .\#*
	-cd files; rm -f *~ \#* .\#*
	-rm -fr ../local/var/log/*.log
	-rm -fr ../local/var/lib/ocsidb
	-rm -fr ../local/etc/${PROJECTNAME}.conf
	-rm -fr ../local/etc/${PROJECTNAME}.conf.opt

depend:
	${MAKE} -C baselib depend
	${MAKE} -C http depend
	${MAKE} -C server depend
	${MAKE} -C extensions depend