X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=Makefile;h=3929e5dc3057f23ff76c26ad5099ca097ef4b544;hb=ea49f59b7723e700c720cc89c26864e68c113237;hp=d17d8a7385508f3fd3e6a9dd243c11f943006c9b;hpb=74cb4994304c64060d511e7d5a0c524e26357e31;p=libfirm diff --git a/Makefile b/Makefile index d17d8a738..3929e5dc3 100644 --- a/Makefile +++ b/Makefile @@ -14,29 +14,50 @@ variant ?= debug srcdir ?= $(top_srcdir) builddir ?= $(top_builddir)/$(variant) +docdir ?= $(top_builddir)/doc # This hides the noisy commandline outputs. You can see them with "make Q=" Q ?= @ CC ?= cc +DOXYGEN ?= doxygen LINK ?= $(CC) -AR ?= ar ru -RANLIB ?= ranlib +AR ?= ar +DLLEXT ?= .so # Variants -CFLAGS_debug = -O0 -g3 -DDEBUG_libfirm -CFLAGS_profile = -O3 -pg -DNDEBUG -fno-inline -LINKFLAGS_profile = -pg -CFLAGS_optimize = -O3 -DNDEBUG +CFLAGS_all = -std=c99 -fPIC -DHAVE_FIRM_REVISION_H +CFLAGS_debug = $(CFLAGS_all) -O0 -g3 -DDEBUG_libfirm +CFLAGS_profile = $(CFLAGS_all) -O3 -pg -DNDEBUG -fno-inline +CFLAGS_coverage = $(CFLAGS_all) -O0 --coverage -DDEBUG_libfirm +LINKFLAGS_profile = -pg +LINKFLAGS_coverage = --coverage +CFLAGS_optimize = $(CFLAGS_all) -O3 -fomit-frame-pointer -DNDEBUG # General flags CFLAGS += $(CFLAGS_$(variant)) CFLAGS += -Wall -W -Wextra -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings -LINKFLAGS += $(LINKFLAGS_$(variant)) +LINKFLAGS += $(LINKFLAGS_$(variant)) -lm VPATH = $(srcdir) -.PHONY: all +REVISION ?= $(shell git describe --abbrev=40 --always --dirty --match '') + +# Update revision.h if necessary +UNUSED := $(shell \ + REV="\#define libfirm_VERSION_REVISION \"$(REVISION)\""; \ + echo "$$REV" | cmp -s - firm_revision.h 2> /dev/null || echo "$$REV" > firm_revision.h \ +) + all: firm +.PHONY: all + +# disable make builtin suffix rules +.SUFFIXES: + +# This rule is necessary so that make does not abort if headers get deleted +# (the deleted header might still be referenced in a .d file) +%.h: + @: # A very naive way to create a config.h if it is missing $(srcdir)config.h: @@ -44,9 +65,7 @@ $(srcdir)config.h: $(Q)rm -f $@ $(Q)echo "#define libfirm_VERSION_MAJOR 1" >> $@ $(Q)echo "#define libfirm_VERSION_MICRO 0" >> $@ - $(Q)echo "#define libfirm_VERSION_MINOR 20" >> $@ - $(Q)echo "#define HAVE_LONG_DOUBLE 1" >> $@ - $(Q)echo "#define FIRM_STATISTICS" >> $@ + $(Q)echo "#define libfirm_VERSION_MINOR 21" >> $@ # libFirm libfirm_DIRS := \ @@ -62,19 +81,21 @@ libfirm_DIRS := \ ir/ir \ ir/lower \ ir/libcore \ + ir/lpp \ ir/opt \ ir/st \ ir/stat \ ir/tr \ ir/tv \ + ir/kaps \ ir/be libfirm_SOURCES = $(foreach dir,$(libfirm_DIRS),$(wildcard $(dir)/*.c)) libfirm_a = $(builddir)/libfirm.a -libfirm_so = $(builddir)/libfirm.so +libfirm_dll = $(builddir)/libfirm$(DLLEXT) libfirm_CPPFLAGS = -Iinclude/libfirm -Iinclude/libfirm/adt -I. $(foreach dir,$(libfirm_DIRS),-I$(dir)) .PHONY: firm -firm: $(libfirm_so) +firm: $(libfirm_dll) # backends backends = amd64 arm ia32 sparc TEMPLATE @@ -82,7 +103,6 @@ backends = amd64 arm ia32 sparc TEMPLATE EMITTER_GENERATOR = $(srcdir)ir/be/scripts/generate_emitter.pl REGALLOC_IF_GENERATOR = $(srcdir)ir/be/scripts/generate_regalloc_if.pl OPCODES_GENERATOR = $(srcdir)ir/be/scripts/generate_new_opcodes.pl -MACHINE_GENERATOR = $(srcdir)ir/be/scripts/generate_machine.pl define backend_template $(1)_SOURCES = $$(wildcard ir/be/$(1)/*.c) @@ -103,12 +123,6 @@ $$(srcdir)ir/be/$(1)/gen_$(1)_regalloc_if.h $$(srcdir)ir/be/$(1)/gen_$(1)_regall $(1)_SOURCES += ir/be/$(1)/gen_$(1)_regalloc_if.c $(1)_GEN_HEADERS += ir/be/$(1)/gen_$(1)_regalloc_if.h -$$(srcdir)ir/be/$(1)/gen_$(1)_machine.h $$(srcdir)ir/be/$(1)/gen_$(1)_machine.c: $$($(1)_SPEC) $$(MACHINE_GENERATOR) - @echo GEN $$@ - $(Q)$$(MACHINE_GENERATOR) $$($(1)_SPEC) $$(srcdir)ir/be/$(1) -$(1)_SOURCES += ir/be/$(1)/gen_$(1)_machine.c -$(1)_GEN_HEADERS += ir/be/$(1)/gen_$(1)_machine.h - $$(srcdir)ir/be/$(1)/gen_$(1)_new_nodes.h $$(srcdir)ir/be/$(1)/gen_$(1)_new_nodes.c.inl: $$($(1)_SPEC) $$(OPCODES_GENERATOR) @echo GEN $$@ $(Q)$$(OPCODES_GENERATOR) $$($(1)_SPEC) $$(srcdir)ir/be/$(1) @@ -142,10 +156,7 @@ $(IR_SPEC_GENERATED_FILES): $(IR_SPEC_GENERATOR) $(IR_SPEC) scripts/spec_util.py $(Q)$(IR_SPEC_GENERATOR) $(IR_SPEC) ir/ir IR_IO_GENERATOR := scripts/gen_ir_io.py -IR_IO_GENERATED_FILES := \ - ir/ir/gen_irio_import.inl \ - ir/ir/gen_irio_export.inl \ - ir/ir/gen_irio_lex.inl +IR_IO_GENERATED_FILES := ir/ir/gen_irio.inl $(IR_IO_GENERATED_FILES): $(IR_IO_GENERATOR) $(IR_SPEC) scripts/spec_util.py @echo GEN $@ @@ -159,13 +170,11 @@ libfirm_DEPS = $(libfirm_OBJECTS:%.o=%.d) $(libfirm_a): $(libfirm_OBJECTS) @echo AR $@ - $(Q)$(AR) ru $@ $^ - @echo RANLIB $@ - $(Q)$(RANLIB) $@ + $(Q)$(AR) -cru $@ $^ -$(libfirm_so): $(libfirm_OBJECTS) +$(libfirm_dll): $(libfirm_OBJECTS) @echo LINK $@ - $(Q)$(LINK) -shared -o $@ $^ + $(Q)$(LINK) -shared $(LINKFLAGS) -o $@ $^ # Generic rules UNUSED := $(shell mkdir -p $(libfirm_DIRS:%=$(builddir)/%)) @@ -173,8 +182,22 @@ $(builddir)/%.o: %.c $(IR_SPEC_GENERATED_FILES) config.h @echo CC $@ $(Q)$(CC) $(CFLAGS) $(CPPFLAGS) $(libfirm_CPPFLAGS) -MMD -c -o $@ $< +$(docdir)/libfirm.tag: $(IR_SPEC_GENERATED_FILES) Doxyfile $(wildcard include/libfirm/*.h) $(wildcard include/libfirm/adt/*.h) + @echo Doxygen $@ + $(Q)$(DOXYGEN) + +DOCU_GENERATOR := scripts/gen_docu.py +$(docdir)/html/nodes.html: $(docdir)/libfirm.tag $(DOCU_GENERATOR) $(IR_SPEC) scripts/spec_util.py scripts/style.css + @echo gen_docu.py $@ + $(Q)$(DOCU_GENERATOR) $(IR_SPEC) $(docdir)/libfirm.tag "" $@ + $(Q)cp scripts/style.css $(docdir)/html + +.PHONY: doc +doc: $(docdir)/libfirm.tag $(docdir)/html/nodes.html + .PHONY: clean clean: @echo CLEAN $(Q)rm -f $(libfirm_OBJECTS) $(Q)rm -f $(libfirm_TARGET) + $(Q)rm -f $(shell find ir/ -name "gen_*.[ch]")