File: Makefile

package info (click to toggle)
luakit 1:2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 2,748 kB
  • sloc: ansic: 12,337; makefile: 136; ruby: 79; sh: 42
file content (135 lines) | stat: -rw-r--r-- 5,441 bytes parent folder | download
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# Include makefile config
include config.mk

# Token lib generation
TLIST = common/tokenize.list
THEAD = common/tokenize.h
TSRC  = common/tokenize.c

SRCS  = $(filter-out $(TSRC),$(wildcard *.c) $(wildcard common/*.c) $(wildcard common/clib/*.c) $(wildcard clib/*.c) $(wildcard clib/soup/*.c) $(wildcard widgets/*.c)) $(TSRC)
HEADS = $(wildcard *.h) $(wildcard common/*.h) $(wildcard common/clib/*.h) $(wildcard widgets/*.h) $(wildcard clib/*.h) $(wildcard clib/soup/*.h) $(THEAD) buildopts.h
OBJS  = $(foreach obj,$(SRCS:.c=.o),$(obj))

EXT_SRCS = $(filter-out $(TSRC),$(wildcard extension/*.c) $(wildcard extension/clib/*.c) $(wildcard common/*.c)) $(wildcard common/clib/*.c) $(TSRC)
EXT_OBJS = $(foreach obj,$(EXT_SRCS:.c=.o),$(obj))

# List of sources used to generate Lua API documentation
# Must be kept in sync with doc/docgen.ld
DOC_SRCS = $(filter-out lib/markdown.lua lib/lousy/init.lua,$(shell for d in doc/luadoc lib common/clib; do find $$d -type f; done)) tests/lib.lua

all: options newline luakit luakit.1.gz luakit.so apidoc

options:
	@echo luakit build options:
	@echo "CC           = $(CC)"
	@echo "LUA_PKG_NAME = $(LUA_PKG_NAME)"
	@echo "LUA_BIN_NAME = $(LUA_BIN_NAME)"
	@echo "CFLAGS       = $(CFLAGS)"
	@echo "CPPFLAGS     = $(CPPFLAGS)"
	@echo "LDFLAGS      = $(LDFLAGS)"
	@echo "MANPREFIX    = $(MANPREFIX)"
	@echo "DOCDIR       = $(DOCDIR)"
	@echo "XDGPREFIX    = $(XDGPREFIX)"
	@echo "PIXMAPDIR    = $(PIXMAPDIR)"
	@echo "APPDIR       = $(APPDIR)"
	@echo
	@echo build targets:
	@echo "SRCS     = $(SRCS)"
	@echo "HEADS    = $(HEADS)"
	@echo "OBJS     = $(OBJS)"
	@echo "EXT_SRCS = $(EXT_SRCS)"
	@echo "EXT_OBJS = $(EXT_OBJS)"

$(THEAD) $(TSRC): $(TLIST)
	$(LUA_BIN_NAME) ./build-utils/gentokens.lua $(TLIST) $@

buildopts.h: buildopts.h.in
	sed -e 's#LUAKIT_INSTALL_PATH .*#LUAKIT_INSTALL_PATH "$(PREFIX)/share/luakit"#' \
		-e 's#LUAKIT_CONFIG_PATH .*#LUAKIT_CONFIG_PATH "$(XDGPREFIX)"#' \
		-e 's#LUAKIT_DOC_PATH .*#LUAKIT_DOC_PATH "$(DOCDIR)"#' \
		-e 's#LUAKIT_MAN_PATH .*#LUAKIT_MAN_PATH "$(MANPREFIX)"#' \
		-e 's#LUAKIT_PIXMAP_PATH .*#LUAKIT_PIXMAP_PATH "$(PIXMAPDIR)"#' \
		-e 's#LUAKIT_APP_PATH .*#LUAKIT_APP_PATH "$(APPDIR)"#' \
		-e 's#LUAKIT_LIB_PATH .*#LUAKIT_LIB_PATH "$(LIBDIR)"#' \
		buildopts.h.in > buildopts.h

$(filter-out $(EXT_OBJS),$(OBJS)) $(EXT_OBJS): $(HEADS) config.mk

$(filter-out $(EXT_OBJS),$(OBJS)) : %.o : %.c
	@echo $(CC) -c $< -o $@
	@$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@

$(EXT_OBJS) : %.o : %.c
	@echo $(CC) -c $< -o $@
	@$(CC) -c $(CFLAGS) -DLUAKIT_WEB_EXTENSION -fpic $(CPPFLAGS) $< -o $@

widgets/webview.o: $(wildcard widgets/webview/*.c)

luakit: $(OBJS)
	@echo $(CC) -o $@ $(OBJS)
	@$(CC) -o $@ $(OBJS) $(LDFLAGS)

luakit.so: $(EXT_OBJS)
	@echo $(CC) -o $@ $(EXT_OBJS)
	@$(CC) -o $@ $(EXT_OBJS) -shared $(LDFLAGS)

luakit.1: luakit.1.in
	@sed "s/LUAKITVERSION/$(VERSION)/" $< > $@

luakit.1.gz: luakit.1
	@gzip -9 -c $< > $@

doc/apidocs/index.html: $(DOC_SRCS) $(wildcard build-utils/docgen/*)
	rm -rf doc/apidocs
	mkdir doc/apidocs
	$(LUA_BIN_NAME) ./build-utils/docgen/makedoc.lua

apidoc: doc/apidocs/index.html

doc: buildopts.h $(THEAD) $(TSRC)
	doxygen -s doc/luakit.doxygen

clean:
	rm -rf doc/apidocs doc/html luakit $(OBJS) $(EXT_OBJS) $(TSRC) $(THEAD) buildopts.h luakit.1 luakit.1.gz luakit.so

install: all
	install -d $(DESTDIR)$(PREFIX)/share/luakit/
	install -d $(DESTDIR)$(DOCDIR) $(DESTDIR)$(DOCDIR)/classes $(DESTDIR)$(DOCDIR)/modules $(DESTDIR)$(DOCDIR)/pages
	install -m644 README.md AUTHORS $(DESTDIR)$(DOCDIR)
	install -m644 doc/apidocs/classes/* $(DESTDIR)$(DOCDIR)/classes
	install -m644 doc/apidocs/modules/* $(DESTDIR)$(DOCDIR)/modules
	install -m644 doc/apidocs/pages/* $(DESTDIR)$(DOCDIR)/pages
	install -m644 doc/apidocs/*.html $(DESTDIR)$(DOCDIR)
	install -d $(DESTDIR)$(PREFIX)/share/luakit/lib $(DESTDIR)$(PREFIX)/share/luakit/lib/lousy $(DESTDIR)$(PREFIX)/share/luakit/lib/lousy/widget
	install -m644 lib/*.* $(DESTDIR)$(PREFIX)/share/luakit/lib
	install -m644 lib/lousy/*.* $(DESTDIR)$(PREFIX)/share/luakit/lib/lousy
	install -m644 lib/lousy/widget/*.* $(DESTDIR)$(PREFIX)/share/luakit/lib/lousy/widget
	install -d $(DESTDIR)$(PREFIX)/lib/luakit
	install -m644 luakit.so $(DESTDIR)$(PREFIX)/lib/luakit/luakit.so
	install -d $(DESTDIR)$(PREFIX)/bin
	install luakit $(DESTDIR)$(PREFIX)/bin/luakit
	install -d $(DESTDIR)$(XDGPREFIX)/luakit/
	install -m644 config/*.lua $(DESTDIR)$(XDGPREFIX)/luakit/
	install -d $(DESTDIR)$(PIXMAPDIR)
	install -m644 extras/luakit.png $(DESTDIR)$(PIXMAPDIR)
	install -d $(DESTDIR)$(APPDIR)
	install -m644 extras/luakit.desktop $(DESTDIR)$(APPDIR)
	install -d $(DESTDIR)$(MANPREFIX)/man1/
	install -m644 luakit.1.gz $(DESTDIR)$(MANPREFIX)/man1/
	mkdir -p resources
	find resources -type d -exec install -d $(DESTDIR)$(PREFIX)/share/luakit/'{}' \;
	find resources -type f -exec sh -c 'f="{}"; install -m644 "$$f" "$(DESTDIR)$(PREFIX)/share/luakit/$$(dirname $$f)"' \;

uninstall:
	rm -rf $(DESTDIR)$(PREFIX)/bin/luakit $(DESTDIR)$(PREFIX)/share/luakit $(DESTDIR)$(PREFIX)/lib/luakit
	rm -rf $(DESTDIR)$(MANPREFIX)/man1/luakit.1.gz $(DESTDIR)$(XDGPREFIX)/luakit
	rm -rf $(DESTDIR)$(APPDIR)/luakit.desktop $(DESTDIR)$(PIXMAPDIR)/luakit.png

tests/util.so: tests/util.c Makefile
	$(CC) -fpic $(CFLAGS) $(CPPFLAGS) -shared $< $(LDFLAGS) -o $@

run-tests: luakit luakit.so tests/util.so
	@$(LUA_BIN_NAME) tests/run_test.lua

newline: options;@echo
.PHONY: all clean options install newline apidoc doc default