Skip to content
This repository has been archived by the owner on Sep 26, 2022. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
lemonn_k committed Apr 27, 2017
1 parent 694d9fe commit ffef0ec
Show file tree
Hide file tree
Showing 32 changed files with 8,245 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

# ocamlbuild working directory
_build/
_server/
_client/
local/

# ocamlbuild targets
*.byte
Expand Down
162 changes: 162 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@

## Sample Makefile for eliom application.

APP_NAME := utodo
STATICDIR := static

## Packages required to build the server part of the application

SERVER_PACKAGES := lwt.ppx js_of_ocaml.deriving.ppx atdgen uuidm

## Packages to be linked in the client part

CLIENT_PACKAGES := lwt.ppx js_of_ocaml.ppx js_of_ocaml.deriving.ppx atdgen uuidm

## Source files for the server part

SERVER_FILES := src/ulist_t.mli \
src/ulist_j.mli \
src/ulist_t.ml \
src/ulist_j.ml \
src/services.eliom \
src/tools.eliom \
src/category.eliom \
src/menu.eliom \
src/ulist_fs.eliom \
src/ulist_btn.eliom \
src/ulist.eliom \
src/utodo.eliom

## Source files for the client part

CLIENT_FILES := $(SERVER_FILES)

## Required binaries

ELIOMC := eliomc
ELIOMOPT := eliomopt
ELIOMDEP := eliomdep
JS_OF_ELIOM := js_of_eliom -ppx

## Where to put intermediate object files.
## - ELIOM_{SERVER,CLIENT}_DIR must be distinct
## - ELIOM_CLIENT_DIR mustn't be the local dir.
## - ELIOM_SERVER_DIR could be ".", but you need to
## remove it from the "clean" rules...

export ELIOM_SERVER_DIR := _server
export ELIOM_CLIENT_DIR := _client
export ELIOM_TYPE_DIR := .

#####################################

all: byte install
byte:: ${APP_NAME}.cma ${APP_NAME}.js
opt:: ${APP_NAME}.cmxs ${APP_NAME}.js

#### Server side compilation #######

SERVER_DIRS := $(shell echo $(foreach f, $(SERVER_FILES), $(dir $(f))) | tr ' ' '\n' | sort -u | tr '\n' ' ')
SERVER_DEP_DIRS := ${addprefix -eliom-inc ,${SERVER_DIRS}}
SERVER_INC_DIRS := ${addprefix -I $(ELIOM_SERVER_DIR)/, ${SERVER_DIRS}}

SERVER_INC := ${addprefix -package ,${SERVER_PACKAGES}}
SERVER_DB_INC := ${addprefix -package ,${SERVER_DB_PACKAGES}}

SERVER_OBJS := $(patsubst %.mli,${ELIOM_SERVER_DIR}/%.cmi, ${SERVER_FILES})
SERVER_OBJS := $(patsubst %.ml,${ELIOM_SERVER_DIR}/%.cmo, ${SERVER_OBJS})
SERVER_OBJS := $(patsubst %.eliom,${ELIOM_SERVER_DIR}/%.cmo, ${SERVER_OBJS})

${ELIOM_SERVER_DIR}/%.type_mli: %.eliom
${ELIOMC} -ppx -infer ${SERVER_INC} ${SERVER_INC_DIRS} $<


${APP_NAME}.cma: depend ${SERVER_OBJS}
${ELIOMC} -a -o $@ $(filter %.cmo,${SERVER_OBJS})
${APP_NAME}.cmxa: ${SERVER_OBJS:.cmo=.cmx}
${ELIOMOPT} -a -o $@ $^

%.cmxs: %.cmxa
$(ELIOMOPT) -ppx -shared -linkall -o $@ $(GENERATE_DEBUG) $<

${ELIOM_SERVER_DIR}/%.cmi: %.mli
${ELIOMC} -ppx -c ${SERVER_INC} ${SERVER_INC_DIRS} $(GENERATE_DEBUG) $<

${ELIOM_SERVER_DIR}/%.cmi: %.eliomi
${ELIOMC} -ppx -c ${SERVER_INC} ${SERVER_INC_DIRS} $(GENERATE_DEBUG) $<

${ELIOM_SERVER_DIR}/%.cmo: %.ml
${ELIOMC} -ppx -c ${SERVER_INC} ${SERVER_INC_DIRS} $(GENERATE_DEBUG) $<
${ELIOM_SERVER_DIR}/%.cmo: %.eliom
${ELIOMC} -ppx -c ${SERVER_INC} ${SERVER_INC_DIRS} $(GENERATE_DEBUG) $<

${ELIOM_SERVER_DIR}/%.cmx: %.ml
${ELIOMOPT} -ppx -c ${SERVER_INC} ${SERVER_INC_DIRS} $(GENERATE_DEBUG) $<
${ELIOM_SERVER_DIR}/%.cmx: %.eliom
${ELIOMOPT} -ppx -c ${SERVER_INC} ${SERVER_INC_DIRS} $(GENERATE_DEBUG) $<

##### Client side compilation ####

CLIENT_DIRS := $(shell echo $(foreach f, $(CLIENT_FILES), $(dir $(f))) | tr ' ' '\n' | sort -u | tr '\n' ' ')
CLIENT_DEP_DIRS := ${addprefix -eliom-inc ,${CLIENT_DIRS}}
CLIENT_INC_DIRS := ${addprefix -I $(ELIOM_CLIENT_DIR)/,${CLIENT_DIRS}}

CLIENT_LIBS := ${addprefix -package ,${CLIENT_PACKAGES}}
CLIENT_INC := ${addprefix -package ,${CLIENT_PACKAGES}}

CLIENT_OBJS := $(filter %.eliom %.ml %.mli, $(CLIENT_FILES))
CLIENT_OBJS := $(patsubst %.mli,${ELIOM_CLIENT_DIR}/%.cmi, $(CLIENT_OBJS))
CLIENT_OBJS := $(patsubst %.eliom,${ELIOM_CLIENT_DIR}/%.cmo, ${CLIENT_OBJS})
CLIENT_OBJS := $(patsubst %.ml,${ELIOM_CLIENT_DIR}/%.cmo, ${CLIENT_OBJS})

${APP_NAME}.js: ${CLIENT_OBJS}
${JS_OF_ELIOM} -o $@ ${CLIENT_LIBS} $(filter %.cmo,${CLIENT_OBJS})

${ELIOM_CLIENT_DIR}/%.cmi: %.mli
${JS_OF_ELIOM} -c ${CLIENT_INC} ${CLIENT_INC_DIRS} $(GENERATE_DEBUG) $<

${ELIOM_CLIENT_DIR}/%.cmo: %.eliom
${JS_OF_ELIOM} -c ${CLIENT_INC} ${CLIENT_INC_DIRS} $(GENERATE_DEBUG) $<
${ELIOM_CLIENT_DIR}/%.cmo: %.ml
${JS_OF_ELIOM} -c ${CLIENT_INC} ${CLIENT_INC_DIRS} $(GENERATE_DEBUG) $<

${ELIOM_CLIENT_DIR}/%.cmi: %.eliomi
${JS_OF_ELIOM} -c ${CLIENT_INC} ${CLIENT_INC_DIRS} $(GENERATE_DEBUG) $<
############

## Clean up

clean:
-rm -f src/*.cm[ioax] *.cmxa *.cmxs *.o *.a *.annot
-rm -f src/*.type_mli
-rm -f .depend
-rm -f ${APP_NAME}.js
-rm -rf ${ELIOM_CLIENT_DIR} ${ELIOM_SERVER_DIR}

distclean: clean.local
-rm -f *~ \#* .\#*

## Dependencies

depend: .depend
.depend: ${SERVER_FILES} ${CLIENT_FILES}
$(ELIOMDEP) -server -ppx ${SERVER_INC} ${SERVER_FILES} | sed 's,src,_server/src,g' > .depend
$(ELIOMDEP) -client -ppx ${CLIENT_INC} ${CLIENT_FILES} | sed 's,src,_server/src,g' >> .depend

## Warning: Dependencies towards *.eliom are not handled by eliomdep yet.

include .depend

## installation #########

install:
@mkdir -p $(STATICDIR)/
@cp $(APP_NAME).js $(STATICDIR)/$(APP_NAME).js


## test

test.byte: byte
cp utodo.cma local/lib/utodo/utodo.cma
cp utodo.js local/var/www/utodo/eliom/utodo.js
ocsigenserver -c local/etc/utodo/utodo-test.conf
1 change: 1 addition & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Still in development
1 change: 1 addition & 0 deletions lists/installs/sub
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"emails":["test@test.fr"],"tasks":[{"uuid":"df030edd-95bd-4880-8e88-2a7fa94332c2","subList":false,"label":"nested 1","status":true},{"uuid":"bf797cc3-c3ab-4a1e-b62c-4a28d97a43e0","subList":false,"label":"nested 2","status":false}]}
Empty file added lists/projets/bidule
Empty file.
1 change: 1 addition & 0 deletions lists/projets/test
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"emails":["test@test.fr"],"tasks":[{"uuid":"bf797cc3-c3ab-4a1e-b62c-4a28d97aD3e0","subList":false,"label":"premiere","status":true},{"uuid":"f95fde90-5af9-4582-addf-7686db710040","subList":true,"label":"installs/sub","status":false},{"uuid":"d6fc976e-abfc-4fed-82a1-80b351285bc4","subList":false,"label":"deuxieme","status":true}]}
11 changes: 11 additions & 0 deletions src/atd/ulist.atd
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
type task = {
uuid : string;
subList : bool;
label : string;
status : bool;
}

type ulist = {
emails : string list;
tasks : task list;
}
Loading

0 comments on commit ffef0ec

Please sign in to comment.