Skip to content

Commit

Permalink
Diminish the notion of prelude #84
Browse files Browse the repository at this point in the history
  • Loading branch information
xonixx committed Dec 8, 2021
1 parent e44ab6f commit 2ba018e
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions makesure.awk
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ function handleDefineLine(line, kv,l) {
splitKV(line, kv)

if (!(kv[0] in DefineOverrides)) {
handleCodeLine(l = line "; export " kv[0])
handleCodeLine("echo " quoteArg(l) " >> " DefinesFile)
addCodeLine(l = line "; export " kv[0])
addCodeLine("echo " quoteArg(l) " >> " DefinesFile)
}
}

Expand Down Expand Up @@ -540,22 +540,29 @@ function getMyDir(makesurefilePath) {
return executeGetLine("cd \"$(dirname " quoteArg(makesurefilePath) ")\";pwd")
}

function handleCodeLine(line, goalName, name, i) {
function handleCodeLine(line) {
if (isPrelude() && line !~ /^#/ && trim(line) != "" && !ShellInPreludeErrorShown++)
addError("Shell code is not allowed in prelude area")
else
addCodeLine(line)
}

function addCodeLine(line, goalName, name, i) {
if ("lib" == Mode) {
name = currentLibName()
#print "Append line for '" name "': " line
Lib[name] = addL(Lib[name], line)
} else if ("goal_glob" == Mode) {
for (i=0; i < GlobCnt; i++){
if (!Code[goalName = globGoal(i)])
addCodeLine(goalName, makeGlobVarsCode(i))
addCodeLine(goalName, line)
addCodeLineToGoal(goalName, makeGlobVarsCode(i))
addCodeLineToGoal(goalName, line)
}
} else
addCodeLine(currentGoalName(), line)
addCodeLineToGoal(currentGoalName(), line)
}

function addCodeLine(name, line) {
function addCodeLineToGoal(name, line) {
#print "Append line for '" name "': " line
Code[name] = addL(Code[name], line)
}
Expand Down

0 comments on commit 2ba018e

Please sign in to comment.