better makefile

This commit is contained in:
array-in-a-matrix 2022-11-15 11:45:52 -05:00
parent 173291a378
commit 5bc5e85110
3 changed files with 23 additions and 6 deletions

3
.gitignore vendored
View File

@ -2,4 +2,5 @@
nimcache/
nimblecache/
htmldocs/
bin/
doc/

View File

@ -1,16 +1,21 @@
BUILD_DIR := bin/
SOURCE_DIR := src/
SRC_DIR := src/
DOC_DIR := doc/
DOC_TYPE ?= doc
all:
nim compile --out:$(BUILD_DIR) $(SOURCE_DIR)*.nim
nim compile --out:$(BUILD_DIR) $(SRC_DIR)*.nim
doc:
nim $(DOC_TYPE) --outdir:$(DOC_DIR) $(SRC_DIR)*.nim
release:
nim compile --define:release --out:$(BUILD_DIR) $(SOURCE_DIR)*.nim
nim compile --define:release --out:$(BUILD_DIR) $(SRC_DIR)*.nim
run:
@$(BUILD_DIR)main
clean:
@rm -rf $(BUILD_DIR)
@rm -rf $(BUILD_DIR) $(DOC_DIR)
clear: clean

View File

@ -1 +1,12 @@
echo "Hello, World!"
## This module is a sample.
import strutils
proc helloWorld*(times: int) =
## Takes an integer and outputs
## as many indented "hello world!"s
for i in 0 .. times-1:
echo "hello world!".indent(2) # using indent to avoid `UnusedImport`
helloWorld(5)