stevedonovan / Lake

A Lua-based Build Tool
MIT License
132 stars 16 forks source link

Clean target not removing some files? #41

Open soccermitchy opened 9 years ago

soccermitchy commented 9 years ago

When I run lake then lake clean:

mitchell@mitchs1:~/hub$ ls
lakefile.lua  lakefile.real  lua-cmsgpack  luajit-nanomsg  src
mitchell@mitchs1:~/hub$ lake
gcc -c -O2 -Wall -I/usr/include/lua5.1   -fpic -MMD  lua-cmsgpack/lua_cmsgpack.c -o lua_cmsgpack.o
gcc lua_cmsgpack.o  -Wl,-s -shared -o build/lua_cmsgpack.so
unset LUA_PATH;unset LUA_CPATH;luajit -O3 -bst raw src/main.lua build/main.lc
unset LUA_PATH;unset LUA_CPATH;luajit -O3 -bst raw luajit-nanomsg/nanomsg-ffi.lua build/nanomsg-ffi.lc
mitchell@mitchs1:~/hub$ lake clean
removing        build/lua_cmsgpack.so
removing        lua_cmsgpack.o
removing        lua_cmsgpack.d
lake: up to date
mitchell@mitchs1:~/hub$ ls
build  lakefile.lua  lakefile.real  lua-cmsgpack  luajit-nanomsg  src
mitchell@mitchs1:~/hub$ ls build
main.lc  nanomsg-ffi.lc
mitchell@mitchs1:~/hub$

Here's lakefile.lua and .real: lakefile.lua

local f = assert(loadfile("lakefile.real"))
return xpcall(f,debug.traceback)

lakefile.real

OUT=OUT or 'build'
DEBUG=DEBUG or 'false'
DEBUG=DEBUG=='true'

if DEBUG then
    LUAJCFLAGS="-O3 -bgt raw"
    --CFLAGS="-g"
else
    LUAJCFLAGS="-O3 -bst raw"
end
if not path.isdir(OUT) then
    path.mkdir(OUT)
end
function fileCheck(filename)
    if not path.isfile(filename) then
        quit("Did you read the readme? File missing on check for "..filename)
    end
end
-----------------
-- BUILD RULES --
-----------------
-----------------
-- luaj compile--
-----------------
luac=rule(".lc",".lua","unset LUA_PATH;unset LUA_CPATH;luajit "..LUAJCFLAGS.." $(INPUT) "..OUT.."/$(TARGET)")
luac("src/*.lua")

-----------------
--   msgpack   --
-----------------
fileCheck("lua-cmsgpack/lua_cmsgpack.c")
msgpack=c.shared{OUT..'/lua_cmsgpack',src="lua-cmsgpack/lua_cmsgpack.c",needs='lua'}

-----------------
--   nanomsg   --
-----------------
fileCheck("luajit-nanomsg/nanomsg-ffi.lua")
luac("luajit-nanomsg/nanomsg-ffi")

----------------
--   TARGETS  --
----------------
target("luac",luac)
target("msgpack",msgpack)

default{msgpack,luac}