1
1
mirror of https://github.com/theoludwig/libcproject.git synced 2025-05-21 23:21:15 +02:00

6 Commits

Author SHA1 Message Date
892cc71391 chore(release): 1.1.0 [skip ci] 2023-01-06 16:47:43 +00:00
86ae85f130 docs: add online documentation link 2023-01-06 17:46:23 +01:00
3fb77f70cb chore: add doxygen-awesome-css git submodule correctly 2023-01-06 17:42:51 +01:00
469859001e perf: improve Makefile to only compile changed files
fixes #4
2023-01-06 17:37:50 +01:00
6932907f05 feat: generate documentation
fixes #1
2023-01-06 16:32:29 +01:00
9fc4cd9139 ci: add lint-commit job 2023-01-06 14:40:15 +01:00
10 changed files with 134 additions and 14 deletions

View File

@ -20,3 +20,12 @@ jobs:
- run: 'make test'
- run: 'make lint'
- run: 'make clean'
lint-commit:
runs-on: 'ubuntu-latest'
steps:
- uses: 'actions/checkout@v3.0.0'
with:
fetch-depth: 0
- uses: 'wagoid/commitlint-github-action@v5.3.0'

View File

@ -21,17 +21,20 @@ jobs:
git_commit_gpgsign: true
- name: 'Install Build Tools'
run: 'sudo apt-get install --yes build-essential gcc make clang-format'
run: 'sudo apt-get install --yes build-essential gcc make clang-format doxygen doxygen-gui doxygen-doc graphviz'
- run: 'make set_version'
- name: 'Generate Documentation'
run: 'make documentation'
- name: 'Use Node.js'
uses: 'actions/setup-node@v3.1.0'
with:
node-version: 'lts/*'
- name: 'Install Release Tools'
run: 'npm install --save-dev semantic-release @commitlint/cli @commitlint/config-conventional @semantic-release/git @semantic-release/exec @saithodev/semantic-release-backmerge'
run: 'npm install --save-dev semantic-release @commitlint/cli @commitlint/config-conventional @semantic-release/git @semantic-release/exec @saithodev/semantic-release-backmerge vercel'
- run: 'rm --force package.json package-lock.json'
@ -41,3 +44,10 @@ jobs:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GIT_COMMITTER_NAME: ${{ secrets.GIT_NAME }}
GIT_COMMITTER_EMAIL: ${{ secrets.GIT_EMAIL }}
- name: 'Deploy to Vercel'
run: 'npx vercel ./documentation/html --token="${VERCEL_TOKEN}" --prod'
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
build
bin
documentation
.vscode
*.out
*.o

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "doxygen-awesome-css"]
path = doxygen-awesome-css
url = https://github.com/jothepro/doxygen-awesome-css.git

28
Doxyfile Normal file
View File

@ -0,0 +1,28 @@
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = libcproject
PROJECT_BRIEF = "C static library easier to use than $(libc) (C standard library)."
OUTPUT_DIRECTORY = documentation
OUTPUT_LANGUAGE = English
OPTIMIZE_OUTPUT_FOR_C = YES
INPUT = ./
INPUT_ENCODING = UTF-8
USE_MDFILE_AS_MAINPAGE = README.md
FILE_PATTERNS = *.h \
README.md
HTML_EXTRA_STYLESHEET = doxygen-awesome-css/doxygen-awesome.css
RECURSIVE = YES
EXCLUDE = test doxygen-awesome-css
GENERATE_LATEX = NO
GENERATE_TREEVIEW = YES
EXAMPLE_PATTERNS = *
SOURCE_BROWSER = YES
INLINE_SIMPLE_STRUCTS = YES
EXTRACT_ALL = YES
EXTRACT_STATIC = YES
SORT_MEMBER_DOCS = NO
FULL_SIDEBAR = NO
DISABLE_INDEX = NO
INLINE_SOURCES = YES
LAYOUT_FILE = DoxygenLayout.xml
HTML_INDEX_NUM_ENTRIES = 1

57
DoxygenLayout.xml Normal file
View File

@ -0,0 +1,57 @@
<doxygenlayout version="1.0">
<!-- Generated by doxygen 1.9.1 -->
<!-- Navigation index tabs for HTML output -->
<navindex>
<tab type="mainpage" visible="yes" title=""/>
<tab type="pages" visible="yes" title="" intro=""/>
<tab type="filelist" visible="yes" title="" intro=""/>
</navindex>
<!-- Layout definition for a file page -->
<file>
<briefdescription visible="yes"/>
<includes visible="$SHOW_INCLUDE_FILES"/>
<includegraph visible="$INCLUDE_GRAPH"/>
<includedbygraph visible="$INCLUDED_BY_GRAPH"/>
<sourcelink visible="yes"/>
<memberdecl>
<interfaces visible="yes" title=""/>
<classes visible="yes" title=""/>
<structs visible="yes" title=""/>
<exceptions visible="yes" title=""/>
<namespaces visible="yes" title=""/>
<constantgroups visible="yes" title=""/>
<defines title=""/>
<typedefs title=""/>
<sequences title=""/>
<dictionaries title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
<membergroups visible="yes"/>
</memberdecl>
<detaileddescription title=""/>
<memberdef>
<inlineclasses title=""/>
<defines title=""/>
<typedefs title=""/>
<sequences title=""/>
<dictionaries title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
</memberdef>
<authorsection/>
</file>
<!-- Layout definition for a directory page -->
<directory>
<briefdescription visible="yes"/>
<directorygraph visible="yes"/>
<memberdecl>
<dirs visible="yes"/>
<files visible="yes"/>
</memberdecl>
<detaileddescription title=""/>
</directory>
</doxygenlayout>

View File

@ -4,41 +4,47 @@ CC_FLAGS = -Wall -Wextra -Wfloat-equal -Wundef -Werror -std=c17 -pedantic -pedan
LIB = ./build/${LIBRARY_NAME}.a
LIB_CC_FLAGS = -L. -l:${LIB}
LIB_SOURCES = $(wildcard lib/*.c)
LIB_OBJECTS = $(patsubst %.c, %.o, $(LIB_SOURCES))
TEST_SOURCES = $(wildcard test/*.c)
TEST_OBJECTS = $(patsubst %.c, %.o, $(TEST_SOURCES))
HEADER_FILES = $(wildcard lib/*.h) $(wildcard test/*.h) ./${LIBRARY_NAME}.h
MAIN_EXECUTABLE = bin/main.exe
SET_VERSION_EXECUTABLE = bin/set_version.exe
TEST_EXECUTABLE = bin/test.exe
.PHONY: all
all: ${LIB_SOURCES}
mkdir --parents ./build
${CC} ${CC_FLAGS} -c ${LIB_SOURCES}
build/%.o: %.c
mkdir --parents ./build/lib ./build/test
${CC} ${CC_FLAGS} -c $< -o $@
${LIB}: $(addprefix build/, ${LIB_OBJECTS})
rm --force ${LIB}
ar -rcs ${LIB} *.o
rm --recursive --force *.o
ar -rcs ${LIB} $(addprefix build/, ${LIB_OBJECTS})
.PHONY: run
run: all ./main.c
run: ${LIB} ./main.c
mkdir --parents ./bin
${CC} ${CC_FLAGS} -o ${MAIN_EXECUTABLE} ./main.c ${LIB_CC_FLAGS}
./${MAIN_EXECUTABLE} ${ARGS}
.PHONY: set_version
set_version: all ./set_version.c
set_version: ${LIB} ./set_version.c
mkdir --parents ./bin
${CC} ${CC_FLAGS} -o ${SET_VERSION_EXECUTABLE} ./set_version.c ${LIB_CC_FLAGS}
.PHONY: test
test: all ${TEST_SOURCES}
test: ${LIB} $(addprefix build/, ${TEST_OBJECTS})
mkdir --parents ./bin
${CC} ${CC_FLAGS} -o ${TEST_EXECUTABLE} ${TEST_SOURCES} ${LIB_CC_FLAGS}
${CC} ${CC_FLAGS} -o ${TEST_EXECUTABLE} $(addprefix build/, ${TEST_OBJECTS}) ${LIB_CC_FLAGS}
./${TEST_EXECUTABLE}
.PHONY: lint
lint:
clang-format --Werror --dry-run ${LIB_SOURCES} ${TEST_SOURCES} ${HEADER_FILES} ./main.c
.PHONY: documentation
documentation:
doxygen ./Doxyfile
.PHONY: clean
clean:
rm --recursive --force ./build ./bin *.out *.o *.exe *.a
rm --recursive --force ./build ./bin ./documentation

View File

@ -22,6 +22,8 @@ C is a low-level programming language and we often end up reinventing the wheel
**libcproject** solve this by providing common functions or data structures (`dictionary`, `linked_list`, `queue`, `stack`, etc.) we might need in our C projects.
[Online documentation](https://libcproject.vercel.app/).
## Prerequisites
- [GNU coreutils](https://www.gnu.org/software/coreutils/)
@ -29,11 +31,13 @@ C is a low-level programming language and we often end up reinventing the wheel
- [GNU gcc](https://gcc.gnu.org/)
- [GNU make](https://www.gnu.org/software/make/)
- [clang-format](https://clang.llvm.org/docs/ClangFormat.html)
- [Doxygen](https://www.doxygen.nl/)
For example on GNU/Linux Ubuntu:
```sh
sudo apt-get install build-essential gcc make clang-format
sudo apt-get install doxygen doxygen-gui doxygen-doc graphviz
```
## Usage
@ -43,6 +47,7 @@ make # to compile
make run # to run main
make test # to run unit tests
make lint # to lint the code
make documentation # to generate the documentation
make clean # to clean up
nm ./build/libcproject.a # to see the symbols

1
doxygen-awesome-css Submodule

Submodule doxygen-awesome-css added at a3c119b479

View File

@ -1,4 +1,4 @@
#ifndef __LIBCPROJECT_VERSION__
#define __LIBCPROJECT_VERSION__ "1.0.0"
#define __LIBCPROJECT_VERSION__ "1.1.0"
#endif