summaryrefslogtreecommitdiffhomepage
path: root/core/Makefile
blob: dbebb52d9ee53cb3b85e027d193b5abd29047d82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
LUAC = luac
LUAC_OPTIONS = -s

FILES = ffluci/debug.lua ffluci/view/*.htm ffluci/view/cbi/*.htm ffluci/i18n/*

CFILES = ffluci/bits.lua ffluci/util.lua \
ffluci/sgi/haserl.lua ffluci/sgi/webuci.lua \
ffluci/http.lua ffluci/fs.lua ffluci/sys.lua \
ffluci/model/uci/wrapper.lua ffluci/model/uci/libuci.lua ffluci/model/uci.lua \
ffluci/model/ipkg.lua ffluci/config.lua ffluci/i18n.lua ffluci/template.lua \
ffluci/cbi.lua ffluci/dispatcher.lua ffluci/menu.lua ffluci/init.lua 

DIRECTORIES = ffluci/model/cbi ffluci/model/menu ffluci/controller ffluci/i18n ffluci/view/cbi ffluci/model/uci ffluci/sgi

OUTDIRS = $(DIRECTORIES:%=dist/%)
INFILES = $(CFILES:%=src/%)
OUTFILE = ffluci/init.lua
CPFILES = $(FILES:%=src/%)

.PHONY: all compile source depends clean

all: compile

depends:
	mkdir -p $(OUTDIRS)
	for i in $(CPFILES); do if [ -f "$$i" ]; then i=$$(echo $$i | cut -d/ -f2-); \
		mkdir -p dist/$$(dirname $$i); cp src/$$i dist/$$i; fi; done

compile: depends
	$(LUAC) $(LUAC_OPTIONS) -o dist/$(OUTFILE) $(INFILES)
	for i in $(CFILES); do [ -f dist/$$i ] || ln -s `dirname $$i | cut -s -d / -f 2- | sed -e 's/[^/]*\/*/..\//g'``basename $(OUTFILE)` dist/$$i; done
	

source: depends
	for i in $(CFILES); do cp src/$$i dist/$$i; done
	
	
clean:
	rm dist -rf