luci-0.11: merge outstanding trunk changes
[project/luci.git] / libs / web / Makefile
1 ifneq (,$(wildcard ../../build/config.mk))
2 include ../../build/config.mk
3 include ../../build/module.mk
4 include ../../build/gccconfig.mk
5 else
6 include standalone.mk
7 endif
8
9 TPL_LDFLAGS =
10 TPL_CFLAGS =
11 TPL_SO = parser.so
12 TPL_PO2LMO = po2lmo
13 TPL_PO2LMO_OBJ = src/po2lmo.o
14 TPL_LMO_OBJ = src/template_lmo.o
15 TPL_COMMON_OBJ = src/template_parser.o src/template_utils.o
16 TPL_LUALIB_OBJ = src/template_lualib.o
17
18 %.o: %.c
19 $(COMPILE) $(TPL_CFLAGS) $(LUA_CFLAGS) $(FPIC) -c -o $@ $<
20
21 compile: build-clean $(TPL_COMMON_OBJ) $(TPL_LUALIB_OBJ) $(TPL_LMO_OBJ) $(TPL_PO2LMO_OBJ)
22 $(LINK) $(SHLIB_FLAGS) $(TPL_LDFLAGS) -o src/$(TPL_SO) \
23 $(TPL_COMMON_OBJ) $(TPL_LMO_OBJ) $(TPL_LUALIB_OBJ)
24 $(LINK) -o src/$(TPL_PO2LMO) \
25 $(TPL_LMO_OBJ) $(TPL_PO2LMO_OBJ)
26 mkdir -p dist$(LUCI_LIBRARYDIR)/template
27 cp src/$(TPL_SO) dist$(LUCI_LIBRARYDIR)/template/$(TPL_SO)
28
29 install: build
30 cp -pR dist$(LUA_LIBRARYDIR)/* $(LUA_LIBRARYDIR)
31
32 clean: build-clean
33
34 build-clean:
35 rm -f src/*.o src/$(TPL_SO)
36
37 host-compile: build-clean host-clean $(TPL_LMO_OBJ) $(TPL_PO2LMO_OBJ)
38 $(LINK) -o src/$(TPL_PO2LMO) $(TPL_LMO_OBJ) $(TPL_PO2LMO_OBJ)
39
40 host-install: host-compile
41 cp src/$(TPL_PO2LMO) ../../build/$(TPL_PO2LMO)
42
43 host-clean:
44 rm -f ../../build/$(TPL_PO2LMO)