summaryrefslogtreecommitdiffhomepage
path: root/libs/web/Makefile
blob: ad16ec737665f405b3482ddce8cbb723fbdc52c4 (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
40
41
42
43
44
45
ifneq (,$(wildcard ../../build/config.mk))
include ../../build/config.mk
include ../../build/module.mk
include ../../build/gccconfig.mk
else
include standalone.mk
endif

TPL_LDFLAGS    =
TPL_CFLAGS     =
TPL_SO         = parser.so
TPL_PO2LMO     = po2lmo
TPL_PO2LMO_OBJ = src/po2lmo.o
TPL_LMO_OBJ    = src/template_lmo.o
TPL_COMMON_OBJ = src/template_parser.o src/template_utils.o
TPL_LUALIB_OBJ = src/template_lualib.o

%.o: %.c
	$(COMPILE) $(TPL_CFLAGS) $(LUA_CFLAGS) $(FPIC) -c -o $@ $<

compile: build-clean $(TPL_COMMON_OBJ) $(TPL_LUALIB_OBJ) $(TPL_LMO_OBJ) $(TPL_PO2LMO_OBJ)
	$(LINK) $(SHLIB_FLAGS) $(TPL_LDFLAGS) -o src/$(TPL_SO) \
		$(TPL_COMMON_OBJ) $(TPL_LMO_OBJ) $(TPL_LUALIB_OBJ)
	$(LINK) -o src/$(TPL_PO2LMO) \
		$(TPL_LMO_OBJ) $(TPL_PO2LMO_OBJ)
	mkdir -p dist$(LUCI_LIBRARYDIR)/template
	cp src/$(TPL_SO) dist$(LUCI_LIBRARYDIR)/template/$(TPL_SO)

install: build
	cp -pR dist$(LUA_LIBRARYDIR)/* $(LUA_LIBRARYDIR)

clean: build-clean

build-clean:
	rm -f src/*.o src/$(TPL_SO)

host-compile: build-clean host-clean $(TPL_LMO_OBJ) $(TPL_PO2LMO_OBJ)
	$(LINK) -o src/$(TPL_PO2LMO) $(TPL_LMO_OBJ) $(TPL_PO2LMO_OBJ)

host-install: host-compile
	cp src/$(TPL_PO2LMO) ../../build/$(TPL_PO2LMO)

host-clean:
	rm -f src/$(TPL_PO2LMO)
	rm -f ../../build/$(TPL_PO2LMO)