New upstream release
[pkg-ocaml-ocsigen.git] / Makefile
blobda480f017c253f5fb525814fe6482392bc87bd49
1 include Makefile.config
3 ### Building
5 .PHONY: all byte opt doc
7 all:
8 ${MAKE} -C src all
10 byte:
11 ${MAKE} -C src byte
13 opt:
14 ${MAKE} -C src opt
16 doc:
17 $(MAKE) -C doc
19 ### Testing and debugging : local execution and toplevel ###
21 .PHONY: run.local run.opt.local top
23 run.local: byte
24 CAML_LD_LIBRARY_PATH=src/server src/server/${PROJECTNAME} -c local/etc/${PROJECTNAME}.conf
26 run.opt.local: opt
27 CAML_LD_LIBRARY_PATH=src/server src/server/${PROJECTNAME}.opt -c local/etc/${PROJECTNAME}.conf
29 top:
30 cd src/server && ${MAKE} top
32 ### Cleaning ###
34 clean: clean.local
35 ${MAKE} -C src clean
37 clean.local:
38 -rm -f $(PROJECTNAME)-*.tar.gz
40 distclean: clean.local
41 ${MAKE} -C src distclean
42 -make -C doc clean
43 -rm Makefile.config
44 -rm -f *~ \#* .\#*
46 ### Installation ####
48 .PHONY: install partialinstall reinstall uninstall
50 install.META:
51 $(MAKE) -C src install
52 install.META.byte:
53 $(MAKE) -C src install.byte
54 install.META.opt:
55 $(MAKE) -C src install.opt
57 reinstall: uninstall install
58 reinstall.byte: uninstall install.byte
59 reinstall.opt: uninstall install.opt
61 install: install.META install.files
62 @echo
63 @echo "## Run \"make doc\" and \"make install.doc\" to build and install the ocamldoc."
65 install.byte: install.META.byte install.files
66 install.opt: install.META.opt install.files
68 install.files:
69 ## Command pipe
70 $(INSTALL) -m 755 -d $(dir $(TEMPROOT)$(COMMANDPIPE))
71 [ -p $(TEMPROOT)$(COMMANDPIPE) ] || \
72 { mkfifo $(TEMPROOT)$(COMMANDPIPE); \
73 $(CHMOD) 660 $(TEMPROOT)$(COMMANDPIPE); \
74 $(CHOWN) -R $(OCSIGENUSER):$(OCSIGENGROUP) $(TEMPROOT)$(COMMANDPIPE); }
75 ## Configuration files
76 $(INSTALL) -m 755 -d $(TEMPROOT)$(CONFIGDIR)/conf.d
77 ${INSTALL} -m 644 ${PROJECTNAME}.conf.sample $(TEMPROOT)$(CONFIGDIR)/
78 [ -f $(TEMPROOT)$(CONFIGDIR)/$(PROJECTNAME).conf ] || \
79 { $(INSTALL) -m 644 $(PROJECTNAME).conf.sample \
80 $(TEMPROOT)$(CONFIGDIR)/$(PROJECTNAME).conf; }
81 -mv $(TEMPROOT)$(CONFIGDIR)/mime.types $(TEMPROOT)$(CONFIGDIR)/mime.types.old
82 ## Log directory
83 $(INSTALL) -m 644 src/files/mime.types $(TEMPROOT)$(CONFIGDIR)
84 $(INSTALL) -d -m 755 -o ${OCSIGENUSER} -g ${OCSIGENGROUP} \
85 $(TEMPROOT)$(LOGDIR)
86 ## Static files
87 $(INSTALL) -d -m 755 -o ${OCSIGENUSER} -g ${OCSIGENGROUP} \
88 $(TEMPROOT)$(STATICPAGESDIR)
89 $(INSTALL) -d -m 750 -o ${OCSIGENUSER} -g ${OCSIGENGROUP} \
90 $(TEMPROOT)$(DATADIR)
91 $(INSTALL) -m 644 -o ${OCSIGENUSER} -g ${OCSIGENGROUP} \
92 local/var/www/*.html $(TEMPROOT)$(STATICPAGESDIR)
93 $(INSTALL) -d -m 755 -o ${OCSIGENUSER} -g ${OCSIGENGROUP} \
94 $(TEMPROOT)$(STATICPAGESDIR)/ocsigenstuff
95 $(INSTALL) -m 644 -o ${OCSIGENUSER} -g ${OCSIGENGROUP} \
96 local/var/www/ocsigenstuff/* $(TEMPROOT)$(STATICPAGESDIR)/ocsigenstuff
97 $(INSTALL) -d -m 755 $(TEMPROOT)$(MANDIR)
98 $(INSTALL) -m 644 src/files/${PROJECTNAME}.1 $(TEMPROOT)$(MANDIR)
100 uninstall:
101 -make -C doc uninstall
102 -rm -f $(TEMPROOT)$(CONFIGDIR)/$(PROJECTNAME).conf.sample
103 -rm -f $(TEMPROOT)$(MANDIR)/${PROJECTNAME}.1
104 -rm -f $(TEMPROOT)$(COMMANDPIPE)
105 -rmdir --ignore-fail-on-non-empty $(TEMPROOT)$(CONFIGDIR)/conf.d
106 -rmdir --ignore-fail-on-non-empty $(TEMPROOT)$(CONFIGDIR)
107 -rmdir --ignore-fail-on-non-empty $(TEMPROOT)$(LOGDIR)
108 -rmdir --ignore-fail-on-non-empty $(TEMPROOT)$(DATADIR)
109 -rmdir --ignore-fail-on-non-empty $(TEMPROOT)$(MANDIR)
110 -$(MAKE) -C src uninstall
112 install.doc:
113 ${MAKE} -C doc install
115 ### Install logrotate configuration files ###
117 .PHONY: logrotate
119 logrotate:
120 $(INSTALL) -m 755 -d $(TEMPROOT)/etc/logrotate.d
121 cat src/files/logrotate.in \
122 | sed s%LOGDIR%$(LOGDIR)%g \
123 | sed s%USER%$(OCSIGENUSER)%g \
124 | sed s%GROUP%$(OCSIGENGROUP)%g \
125 | sed s%_COMMANDPIPE_%$(COMMANDPIPE)%g \
126 > $(TEMPROOT)/etc/logrotate.d/$(PROJECTNAME); }
130 .PHONY: dist
132 VERSION := $(shell head -n 1 VERSION)
133 dist:
134 DARCS_REPO=$(PWD) darcs dist -d $(PROJECTNAME)-$(VERSION)
138 .PHONY: depend
139 depend:
140 ${MAKE} -C src depend