Rules to organize files in large projects, and management system
libft follows the File Hierarchy Standard-like structure
${LIBFT_PACKAGE_ROOT}/
- the rootboot/
- package systemsys/
- temporary directory for package systembin/
- executable binarieslib/
- library binariesetc/
- configuration filesopt/
- something externalhome/
- directory for each packagetmp/
- temporary directory for each packageusr/
- directory for distributeinclude/
- header filesshare/
- data filessrc/
- source files
var/
cache/
- cache directory for each packagelog/
- log directory for each packagelib/
- persistent data for each package
src/
- directory for current source files
Every libft package consists of three folders and some files below:
include/
- header files to distributeshare/
- other files like test datasrc/
- all source filesbin.properties
- optional, consists of a list of binarieslib.properties
- optional, consists of a list of librariesMakefile
- see Makefile rules below
All commands provided as Makefile rules
initialize dependencies
- check
sys/log/current/init_*.log
file existence - if not exist, run
make reinit
remove all generated files
- move
sys/log/current/init_*.log
tosys/log/old
if exist - remove
sys
,bin
,lib
,tmp
,usr
,var
directory
force re-initialize dependencies
- run
make deinit
- create log file
sys/log/tmp/init.log
- create empty file
sys/tmp/init/packages_done.txt
- create file
sys/tmp/init/packages_in_progress.txt
asls -1 home | sort
- loop...
- ...
- remove
sys/tmp/init
- move
sys/log/tmp/init.log
tosys/log/current/init_(timestamp).log
libft package must have Makefile in the project root directory with rules below:
- rules derived from the Norm
all
: build all library/executable final targetsclean
: remove temporary filesfclean
:clean
+ remove result/cache files toore
:all
afterfclean
- additional rules for libft package
init
: initialize/refresh dependenciestest
: test self functionality (e.g. unit test)check
: check functionality (e.g. acceptance test)install
: distribute result files
The rules above requires the environment variable LIBFT_PACKAGE_ROOT
Makefile must be compliant with POSIX makefile for portability
WIP
<first-part> ::= [a-z]
<part> ::= <first-part> | [0-9]
<word>
::= <first-part>
| <word> <part>
The package name is an underscore-concatenated list of one or more non-empty strings beginning with a lowercase letter consisting of a lowercase letter and a number.
<package-name>
::= <word>
| <package-name> "_" <word>
For ease of use, naming files is strictly restricted to (package name)[_*].{c,h}
or (directory)/(package name)__(directory name)[_*].{c,h}
, anything inside another directory is not allowed.
<dist-file-name>
::= "(package-name).c"
| "(package-name).h"
| "(package-name)__" <dist-file-name-part> ".c"
| "(package-name)__" <dist-file-name-part> ".h"
<dist-file-name-part>
::= ""
| <dist-file-name-part> "_" <word>
Example: the allowed file names for some_name
is:
some_name.c
some_name.h
some_name_types.h
impl/some_name_impl.c
impl/some_name_impl_main.c
impl/fallback/some_name_impl_fallback.c
impl/fallback/some_name_impl_fallback_main.c