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/ nimcache/
nimblecache/ nimblecache/
htmldocs/ htmldocs/
bin/
doc/

View file

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