How do I put files in folders while using Eliom? - ocaml

I am beginning to develop a website in ocaml using Eliom. As the project grows, I want to be able to split off different segments of the code into different files and then group these files into folders. I figured out how to split off into different files: In Makefile.options, I change the line:
SERVER_FILES := $(wildcard *.eliomi *.eliom)
to
SERVER_FILES := $(wildcard *.eliomi *.eliom) file.ml
However, I can't figure out how to be able to use .ml files that are in folders. If I naively use:
SERVER_FILES := $(wildcard *.eliomi *.eliom) folder/file.ml
I get the error:
/bin/sh: 1: cannot create _deps/folder/.server: Directory nonexistent
And even if I manually create this file and build again, I get the error:
/bin/sh: 1: Unbound module File
Is there some way I can access files that I put into folders?

Related

Makefile count how many files

I am making a makefile that compiles some .cpp files but i want it to be "beautiful".
So i try to add current index compiling:
(eg: Compiling 10nth out of 150 total files.)
I successfully did the 10nth out of part, but i cannot find a way to get how many total files are in makefile's directory (in my case how many .cpp's).
What i want is to get this 150 number.
So my Question (and i am really curious WHY no one has ever asked) is, how to get how many .cpp files are in this (makefile's) directory.
I hope this question helps other people as well in the future.
You can do something like this using GNU Make:
SOURCES := $(wildcard src/*.cpp)
NO_OF_FILES := $(words $(SOURCES))
Various text processing functions are documented here

Full path of *.cpp files

I need to have full path of C++ files (name of file is not neccesary). It musn't to be depended on path of execution.
I can use __FILE__, hovewer it gives me only name of file. I was seeking in boost::filesystem, but I only found boost::filesystem::current_path() - unfortunately it gives me path of directory from which I run program.
I looking for path of cpp file, not path of exe. I need it for other tool to generate groups of cpp files after directory of cpp files.
Any ideas?
Edit:
Maybe it is possible to use bash script which gives actual directory of cpp file (not sh file)?

Xcode 4 file input/output, command line tool C++

I'm trying to figure out where to save multiple .txt files so that i can have a command line tool project in Xcode read directly in from them while running it.
I understand that Xcode compiles everything to a folder, DerivedData, which i have saved in the same location as my source code for each project respectively.
can i save multiple .txt files anywhere in the DerivedData folder or include it in the build settings and phases so that when i run the command line tool i can type the name of a file, it will read in from that file.
By default the compiled/linked binary will look into its own directory for files.
For example, my binaries are at ProjectName/Build/Products/Debug/ and therefore it will look for files from that dir.
You can use relative path from that folder to the outside.
Or, you can create a symbolic link to another directory (on Terminal):
ln -s source_dir target_file
target_file must be located in the same directory as your binary. And you can reference the other files like "target_file/file1.txt", etc.

Scons: How to add a target for creating a zip file that contains source files?

Say I have a couple of source files (e.g.foo.c, foo.h, bar.c, bar.h, baz.c, baz.h). I want to bundle them together by making a zip file that contains those files by simply typing scons zip. In addition, those files have to be inside a src/ directory in the zip file.
How should I proceed? I've looked at the Mkdir(), Copy() etc. commands in the Scons user manual, but I have no idea how to bundle them together in a single target.
Here's a very simple SConstruct to do what you want. You'll have to modify it for your real source layout and you probably don't want to create a src/ directory at the root of your project.
# list of source, header files
files = ['foo.h', 'foo.c', 'bar.h', 'bar.c', 'baz.h', 'baz.c']
# create the directory structure for the zip file
pkg_files = Install('src', files)
# create the zip file
z = Zip('pkg.zip', pkg_files)
Alias('zip', z)
You can find more information about the Zip Builder on the SCons man page.

Is there a way to get the * command to ignore certain entries?

I have a lot of a files in one of my folders that I need *.c to compile them in my Makefile, but I want to exclude one of them for now. Is there anyway to still use *.c but ignore a specific file?
How about:
SOURCES := $(filter-out foo.c,$(wildcard *.c))