more build fixes
[dana/openbox.git] / build / Makefile.kernel
1 kernel_dir:=kernel
2 kernel_target:=$(binary)
3 kernel_sources:=action.c client.c config.c dispatch.c engine.c event.c \
4                 extensions.c focus.c frame.c grab.c menu.c openbox.c \
5                 parse.c plugin.c prop.c screen.c stacking.c timer.c xerror.c \
6                 lex.yy.c parse.tab.c
7 kernel_lex:=parse.l
8 kernel_yacc:=parse.y
9 kernel_CPPFLAGS:=$(CPPFLAGS) $(GLIB_CFLAGS) $(GMODULE_CFLAGS) $(XFT_CFLAGS) \
10   -DG_LOG_DOMAIN=\"Openbox\"
11 kernel_LIBS:=$(LIBS) $(GLIB_LIBS) $(GMODULE_LIBS) $(XFT_LIBS)
12 kernel_LDFLAGS:=-export-dynamic
13
14 kernel_srcdir:=$(srcdir)/$(kernel_dir)
15 kernel_lex:=$(addprefix $(kernel_srcdir)/,$(kernel_lex))
16 kernel_yacc:=$(addprefix $(kernel_srcdir)/,$(kernel_yacc))
17 kernel_target:=$(addprefix $(kernel_dir)/,$(kernel_target))
18 kernel_objects:=$(addprefix $(kernel_dir)/,$(kernel_sources:.c=.o))
19 kernel_sources:=$(addprefix $(kernel_srcdir)/,$(kernel_sources))
20 kernel_deps:=$(addprefix $(depdir)/,$(kernel_objects:.o=.d))
21 kernel_depdir:=$(depdir)/$(kernel_dir)
22
23 $(kernel_target): $(kernel_objects) $(render_target)
24         $(LIBTOOL) --mode=link $(CC) -o $@ $^ $(kernel_LIBS) $(kernel_LDFLAGS)
25
26 $(kernel_dir):
27         @mkdir $@
28
29 $(kernel_dir)/%.o: $(kernel_srcdir)/%.c $(kernel_depdir)/%.d
30         $(CC) $(DEFS) $(kernel_CPPFLAGS) $(CFLAGS) -c -o $@ $<
31
32 $(kernel_dir)/lex.yy.c: $(kernel_lex)
33         cd kernel && \
34         $(FLEX) $(notdir $<)
35
36 %.tab.h: %.tab.c
37
38 $(kernel_dir)/%.tab.c: $(kernel_srcdir)/%.y
39         cd kernel && \
40         $(BISON) -d $(notdir $<)
41
42 $(kernel_depdir)/%.d: $(kernel_srcdir)/%.c
43         @echo Building dependancies for $<
44         $(INSTALL) -d $(dir $@)
45         @$(CC) $(kernel_CPPFLAGS) $(CFLAGS) -w -MM -MF $@ -MQ $(<:.c=.o) $<
46
47 kernel-install:
48         $(INSTALL) -d $(DESTDIR)$(bindir)/
49         $(INSTALL) $(kernel_target) $(DESTDIR)$(bindir)/$(notdir $(kernel_target))
50
51 kernel-uninstall:
52         -$(RM) $(DESTDIR)$(bindir)/$(notdir $(kernel_target))
53         -rmdir $(DESTDIR)$(bindir)/
54
55 kernel-clean:
56         $(RM) $(kernel_target) $(kernel_objects) $(kernel_dir)/*\~
57         $(RM) $(kernel_srcdir)/lex.yy.c
58         $(RM) $(kernel_yacc:.y=.tab.c) $(kernel_yacc:.y=.tab.h)
59
60 -include $(kernel_deps)
61
62 .PHONY: kernel-install kernel-uninstall kernel-clean