Skip to content

Commit e45941c

Browse files
authored
Merge pull request #74 from ia/makefile
Makefile: add file with basic targets
2 parents a7f857e + 0d997df commit e45941c

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

Makefile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env make -f
2+
3+
### global variables section
4+
5+
# static vars
6+
BUILD_DIR:="build"
7+
BUILD_BIN:="$(BUILD_DIR)/tools/blisp/blisp"
8+
9+
# dynamic vars
10+
FILES_CMAKE:=$(shell find . -path ./$(BUILD_DIR) -prune -false -o -type f -name '*.cmake' -o -type f -name 'CMakeLists.txt')
11+
FILES_SRC:=$(shell find . -path ./$(BUILD_DIR) -prune -false -o -type f -name '*.c' -o -type f -name '*.h')
12+
13+
### main targets section
14+
15+
# simplify build
16+
build: $(FILES_CMAKE) $(FILES_SRC) Makefile
17+
@echo "\n>>>> Generating build files in: $(BUILD_DIR) ...\n"
18+
@cmake -S . -B $(BUILD_DIR) -DBLISP_BUILD_CLI=ON
19+
@echo "\n>>>> Building...\n"
20+
@cmake --build $(BUILD_DIR)
21+
@echo "\n>>>> DONE: $(BUILD_BIN)\n"
22+
23+
# deleting output build directory with its content
24+
clean:
25+
-@rm -rf $(BUILD_DIR)/
26+
27+
# printf-like debug target
28+
vars:
29+
@echo "\n>>>> FILES_CMAKE:"
30+
@echo "$(FILES_CMAKE)" | sed 's, ,\n,g'
31+
@echo "\n>>>> FILES_SRC:"
32+
@echo "$(FILES_SRC)" | sed 's, ,\n,g'
33+
34+
.PHONY: clean vars
35+

0 commit comments

Comments
 (0)