Skip to content

Commit aca5b3c

Browse files
committed
Factor out input.
1 parent 46d1008 commit aca5b3c

File tree

18 files changed

+91
-2276
lines changed

18 files changed

+91
-2276
lines changed

.vimrc_many

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function! MapAllBuff(keys, rhs)
2020
exe 'noremap! <buffer>' a:keys '<ESC>'.a:rhs
2121
endfunction
2222

23-
call MapAllBuff( '<F5>' , ':w<CR>:make<CR>' )
23+
call MapAllBuff('<F5>' , ':w<CR>:make<CR>')
2424
if expand('%:e') =~ '\(c\|cpp\|f\)'
2525
call MapAllBuff('<F6>', ':call RedirStdoutNewTabSingle("make run=''\"' . expand('%:r') . '\"''")<CR>')
2626
call MapAllBuff('<F9>', ':call RedirStdoutNewTabSingle("make profile=''\"' . expand('%:r') . '\"''")<CR>')

Makefile_many

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ OUT_DIR ?= _build/
2626
OUT_EXT ?= #.elf
2727

2828
# Basename without extension of file to run on run target.
29-
RUN ?= main
29+
RUN ?= main
30+
# If exists, will be symlinked into the same directory from which the executable will be run.
31+
# This way, the executable can suppose that this file or directory is in the current directory.
32+
RUN_INPUT ?= input
3033
# Allow users to write `make run=name`.
3134
run ?=
3235

@@ -54,6 +57,7 @@ OUTS := $(addprefix $(OUT_DIR), $(OUTS_NODIR))
5457

5558
all: mkdir $(OUTS)
5659
@#TODO ignore errors if not present
60+
@if [ -e "$(RUN_INPUT)" ] && [ ! -e "$(OUT_DIR)$(RUN_INPUT)" ]; then ln -s ../$(RUN_INPUT) "$(OUT_DIR)$(RUN_INPUT)"; fi
5761
@-$(MAKE) all-post
5862
ifneq ($(strip $(run)),)
5963
cd $(OUT_DIR) && ./"$(run)"

0 commit comments

Comments
 (0)