mirror of
https://github.com/theoludwig/libcproject.git
synced 2024-12-11 21:13:00 +01:00
parent
6932907f05
commit
469859001e
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,9 +1,9 @@
|
|||||||
build
|
build
|
||||||
bin
|
bin
|
||||||
|
documentation
|
||||||
.vscode
|
.vscode
|
||||||
*.out
|
*.out
|
||||||
*.o
|
*.o
|
||||||
*.exe
|
*.exe
|
||||||
*.a
|
*.a
|
||||||
node_modules
|
node_modules
|
||||||
documentation
|
|
||||||
|
24
Makefile
24
Makefile
@ -4,35 +4,37 @@ CC_FLAGS = -Wall -Wextra -Wfloat-equal -Wundef -Werror -std=c17 -pedantic -pedan
|
|||||||
LIB = ./build/${LIBRARY_NAME}.a
|
LIB = ./build/${LIBRARY_NAME}.a
|
||||||
LIB_CC_FLAGS = -L. -l:${LIB}
|
LIB_CC_FLAGS = -L. -l:${LIB}
|
||||||
LIB_SOURCES = $(wildcard lib/*.c)
|
LIB_SOURCES = $(wildcard lib/*.c)
|
||||||
|
LIB_OBJECTS = $(patsubst %.c, %.o, $(LIB_SOURCES))
|
||||||
TEST_SOURCES = $(wildcard test/*.c)
|
TEST_SOURCES = $(wildcard test/*.c)
|
||||||
|
TEST_OBJECTS = $(patsubst %.c, %.o, $(TEST_SOURCES))
|
||||||
HEADER_FILES = $(wildcard lib/*.h) $(wildcard test/*.h) ./${LIBRARY_NAME}.h
|
HEADER_FILES = $(wildcard lib/*.h) $(wildcard test/*.h) ./${LIBRARY_NAME}.h
|
||||||
MAIN_EXECUTABLE = bin/main.exe
|
MAIN_EXECUTABLE = bin/main.exe
|
||||||
SET_VERSION_EXECUTABLE = bin/set_version.exe
|
SET_VERSION_EXECUTABLE = bin/set_version.exe
|
||||||
TEST_EXECUTABLE = bin/test.exe
|
TEST_EXECUTABLE = bin/test.exe
|
||||||
|
|
||||||
.PHONY: all
|
build/%.o: %.c
|
||||||
all: ${LIB_SOURCES}
|
mkdir --parents ./build/lib ./build/test
|
||||||
mkdir --parents ./build
|
${CC} ${CC_FLAGS} -c $< -o $@
|
||||||
${CC} ${CC_FLAGS} -c ${LIB_SOURCES}
|
|
||||||
|
${LIB}: $(addprefix build/, ${LIB_OBJECTS})
|
||||||
rm --force ${LIB}
|
rm --force ${LIB}
|
||||||
ar -rcs ${LIB} *.o
|
ar -rcs ${LIB} $(addprefix build/, ${LIB_OBJECTS})
|
||||||
rm --recursive --force *.o
|
|
||||||
|
|
||||||
.PHONY: run
|
.PHONY: run
|
||||||
run: all ./main.c
|
run: ${LIB} ./main.c
|
||||||
mkdir --parents ./bin
|
mkdir --parents ./bin
|
||||||
${CC} ${CC_FLAGS} -o ${MAIN_EXECUTABLE} ./main.c ${LIB_CC_FLAGS}
|
${CC} ${CC_FLAGS} -o ${MAIN_EXECUTABLE} ./main.c ${LIB_CC_FLAGS}
|
||||||
./${MAIN_EXECUTABLE} ${ARGS}
|
./${MAIN_EXECUTABLE} ${ARGS}
|
||||||
|
|
||||||
.PHONY: set_version
|
.PHONY: set_version
|
||||||
set_version: all ./set_version.c
|
set_version: ${LIB} ./set_version.c
|
||||||
mkdir --parents ./bin
|
mkdir --parents ./bin
|
||||||
${CC} ${CC_FLAGS} -o ${SET_VERSION_EXECUTABLE} ./set_version.c ${LIB_CC_FLAGS}
|
${CC} ${CC_FLAGS} -o ${SET_VERSION_EXECUTABLE} ./set_version.c ${LIB_CC_FLAGS}
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test: all ${TEST_SOURCES}
|
test: ${LIB} $(addprefix build/, ${TEST_OBJECTS})
|
||||||
mkdir --parents ./bin
|
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}
|
./${TEST_EXECUTABLE}
|
||||||
|
|
||||||
.PHONY: lint
|
.PHONY: lint
|
||||||
@ -45,4 +47,4 @@ documentation:
|
|||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
rm --recursive --force ./build ./bin *.out *.o *.exe *.a documentation
|
rm --recursive --force ./build ./bin ./documentation
|
||||||
|
Loading…
Reference in New Issue
Block a user