-include build/Makefile.incl
-
-depdir:=.deps
-
-all: alltargets
-
-include build/Makefile.render
-include build/Makefile.kernel
-include build/Makefile.themes
-include build/Makefile.plugins
-include build/Makefile.engines
-
-alltargets: $(kernel_target) $(plugins_targets) $(engines_targets)
-
-install: all render-install kernel-install themes-install plugins-install engines-install
-
-uninstall: render-uninstall kernel-uninstall themes-uninstall plugins-uninstall engines-uninstall
-
-clean: render-clean kernel-clean plugins-clean engines-clean
+all install uninstall:
+ @$(MAKE) -$(MAKEFLAGS) -f build/Makefile.render $@
+ @$(MAKE) -$(MAKEFLAGS) -f build/Makefile.kernel $@
+# @$(MAKE) -$(MAKEFLAGS) -f build/Makefile.plugins $@
+# @$(MAKE) -$(MAKEFLAGS) -f build/Makefile.engines $@
+# @$(MAKE) -$(MAKEFLAGS) -f build/Makefile.themes $@
+
+clean:
+ @$(MAKE) -$(MAKEFLAGS) -f build/Makefile.render $@
+ @$(MAKE) -$(MAKEFLAGS) -f build/Makefile.kernel $@
+# @$(MAKE) -$(MAKEFLAGS) -f build/Makefile.plugins $@
+# @$(MAKE) -$(MAKEFLAGS) -f build/Makefile.engines $@
+# @$(MAKE) -$(MAKEFLAGS) -f build/Makefile.themes $@
$(RM) *\~
distclean: clean
$(RM) configure Makefile.incl
$(RM) -r .deps/
-.PHONY: all clean distclean
+.PHONY: all clean distclean install uninstall
-kernel_dir:=kernel
-kernel_target:=$(binary)
-kernel_sources:=action.c client.c config.c dispatch.c engine.c event.c \
- extensions.c focus.c frame.c grab.c menu.c openbox.c \
- parse.c plugin.c prop.c screen.c stacking.c timer.c xerror.c \
- lex.yy.c parse.tab.c
-kernel_lex:=parse.l
-kernel_yacc:=parse.y
-kernel_CPPFLAGS:=$(CPPFLAGS) $(GLIB_CFLAGS) $(GMODULE_CFLAGS) $(XFT_CFLAGS) \
- -DG_LOG_DOMAIN=\"Openbox\"
-kernel_LIBS:=$(LIBS) $(GLIB_LIBS) $(GMODULE_LIBS) $(XFT_LIBS)
-kernel_LDFLAGS:=-export-dynamic
-
-kernel_srcdir:=$(srcdir)/$(kernel_dir)
-kernel_lex:=$(addprefix $(kernel_srcdir)/,$(kernel_lex))
-kernel_yacc:=$(addprefix $(kernel_srcdir)/,$(kernel_yacc))
-kernel_target:=$(addprefix $(kernel_dir)/,$(kernel_target))
-kernel_objects:=$(addprefix $(kernel_dir)/,$(kernel_sources:.c=.o))
-kernel_sources:=$(addprefix $(kernel_srcdir)/,$(kernel_sources))
-kernel_deps:=$(addprefix $(depdir)/,$(kernel_objects:.o=.d))
-kernel_depdir:=$(depdir)/$(kernel_dir)
-
-$(kernel_target): $(kernel_objects) $(render_target)
- $(LIBTOOL) --mode=link $(CC) -o $@ $^ $(kernel_LIBS) $(kernel_LDFLAGS)
-
-$(kernel_dir):
- @mkdir $@
-
-$(kernel_dir)/%.o: $(kernel_srcdir)/%.c $(kernel_depdir)/%.d
- $(CC) $(DEFS) $(kernel_CPPFLAGS) $(CFLAGS) -c -o $@ $<
-
-$(kernel_dir)/lex.yy.c: $(kernel_lex)
- cd kernel && \
- $(FLEX) $(notdir $<)
-
-%.tab.h: %.tab.c
-
-$(kernel_dir)/%.tab.c: $(kernel_srcdir)/%.y
- cd kernel && \
- $(BISON) -d $(notdir $<)
-
-$(kernel_depdir)/%.d: $(kernel_srcdir)/%.c
+include build/Makefile.incl
+
+dir = kernel
+
+CPPFLAGS += $(GLIB_CFLAGS) $(GMODULE_CFLAGS) $(XFT_CFLAGS) \
+ -DG_LOG_DOMAIN=\"Openbox\"
+LIBS += $(GLIB_LIBS) $(GMODULE_LIBS) $(XFT_LIBS)
+LDFLAGS = -export-dynamic
+
+target = openbox3
+sources = action.c client.c config.c dispatch.c engine.c event.c \
+ extensions.c focus.c frame.c grab.c menu.c openbox.c \
+ parse.c plugin.c prop.c screen.c stacking.c timer.c xerror.c \
+ parse.lex.c parse.tab.c
+lex = parse.l
+yacc = parse.y
+
+srcdir := $(srcdir)/$(dir)
+lex := $(addprefix $(srcdir)/,$(lex))
+yacc := $(addprefix $(srcdir)/,$(yacc))
+target := $(addprefix $(dir)/,$(target))
+objects := $(addprefix $(dir)/,$(sources:.c=.o))
+sources := $(addprefix $(srcdir)/,$(sources))
+deps := $(addprefix $(depdir)/,$(objects:.o=.d))
+depdir := $(depdir)/$(dir)
+
+all: $(target)
+
+$(target): $(objects) render/librender.a
+ $(LINK) -o $@ $^ $(LIBS) $(LDFLAGS)
+
+$(dir)/%.o: $(srcdir)/%.c $(depdir)/%.d
+ $(COMPILE) -c -o $@ $<
+
+%.lex.c: %.l
+ $(FLEX) -o$@ $<
+
+%.tab.c: %.y
+ $(BISON) -d -o $@ $<
+
+$(depdir)/%.d: $(srcdir)/%.c
@echo Building dependancies for $<
- $(INSTALL) -d $(dir $@)
- @$(CC) $(kernel_CPPFLAGS) $(CFLAGS) -w -MM -MF $@ -MQ $(<:.c=.o) $<
+ $(INSTALL) -d $(depdir)
+ @$(CC) $(CPPFLAGS) $(CFLAGS) -w -MM -MF $@ -MQ $(<:.c=.o) $<
-kernel-install:
+install:
$(INSTALL) -d $(DESTDIR)$(bindir)/
- $(INSTALL) $(kernel_target) $(DESTDIR)$(bindir)/$(notdir $(kernel_target))
+ $(INSTALL) $(target) $(DESTDIR)$(bindir)/$(notdir $(target))
-kernel-uninstall:
- -$(RM) $(DESTDIR)$(bindir)/$(notdir $(kernel_target))
+uninstall:
+ -$(RM) $(DESTDIR)$(bindir)/$(notdir $(target))
-rmdir $(DESTDIR)$(bindir)/
-kernel-clean:
- $(RM) $(kernel_target) $(kernel_objects) $(kernel_dir)/*\~
- $(RM) $(kernel_srcdir)/lex.yy.c
- $(RM) $(kernel_yacc:.y=.tab.c) $(kernel_yacc:.y=.tab.h)
+clean:
+ $(LTCLEAN) $(target)
+ $(RM) $(objects) $(dir)/*\~
+ $(RM) $(filter %.lex.c, $(sources))
+ $(RM) $(filter %.tab.c, $(sources))
+ $(RM) $(patsubst %.c,%.h, $(filter %.tab.c, $(sources)))
+
+distclean:
--include $(kernel_deps)
+-include $(deps)
.PHONY: kernel-install kernel-uninstall kernel-clean
-render_dir:=render
-render_target:=librender.a
-render_sources:=color.c font.c gradient.c image.c mask.c render.c test.c
-render_CPPFLAGS:=$(CPPFLAGS) $(GLIB_CFLAGS) $(XFT_CFLAGS) \
- -DG_LOG_DOMAIN=\"Render\"
-
-render_srcdir:=$(srcdir)/$(render_dir)
-render_target:=$(addprefix $(render_dir)/,$(render_target))
-render_objects:=$(addprefix $(render_dir)/,$(render_sources:.c=.o))
-render_sources:=$(addprefix $(render_srcdir)/,$(render_sources))
-render_deps:=$(addprefix $(depdir)/,$(render_objects:.o=.d))
-render_depdir:=$(depdir)/$(render_dir)
-
-$(render_target): $(render_objects)
- $(AR) r $@ $^
+include build/Makefile.incl
+
+dir = render
+
+CPPFLAGS += $(GLIB_CFLAGS) $(XFT_CFLAGS) -DG_LOG_DOMAIN=\"Render\"
+
+target = librender.a
+sources = color.c font.c gradient.c image.c mask.c render.c test.c
-$(render_dir):
- @mkdir $@
+srcdir := $(srcdir)/$(dir)
+target := $(addprefix $(dir)/, $(target))
+objects := $(addprefix $(dir)/, $(sources:.c=.o))
+sources := $(addprefix $(srcdir)/, $(sources))
+deps := $(addprefix $(depdir)/, $(objects:.o=.d))
+depdir := $(depdir)/$(dir)
-$(render_dir)/%.o: $(render_srcdir)/%.c $(depdir)/%.d
- $(CC) $(DEFS) $(render_CPPFLAGS) $(CFLAGS) -c -o $@ $<
+all: $(target)
-$(render_depdir)/%.d: $(render_srcdir)/%.c
+$(target): $(objects)
+ $(AR) r $@ $^
+
+$(dir)/%.o: $(srcdir)/%.c $(depdir)/%.d
+ $(COMPILE) -c -o $@ $<
+
+$(depdir)/%.d: $(srcdir)/%.c
@echo Building dependancies for $<
- $(INSTALL) -d $(dir $@)
- @$(CC) $(render_CPPFLAGS) $(CFLAGS) -w -MM -MF $@ -MQ $(<:.c=.o) $<
+ @$(INSTALL) -d $(depdir)
+ @$(DEPCOMPILE) -w -MM -MF $@ -MQ $(<:.c=.o) $<
+
+install:
-render-install:
+uninstall:
-render-uninstall:
+clean:
+ $(RM) $(target) $(objects) $(srcdir)/*\~
-render-clean:
- $(RM) $(render_target) $(render_objects) $(render_srcdir)/*\~
+distclean:
--include $(render_deps)
+-include $(deps)
-.PHONY: render-install render-uninstall render-clean
+.PHONY: all install uninstall clean distclean