Use submodule for libfirm binding
authorAndreas Zwinkau <beza1e1@web.de>
Thu, 10 Mar 2011 17:40:59 +0000 (18:40 +0100)
committerAndreas Zwinkau <zwinkau@kit.edu>
Wed, 24 Aug 2011 11:48:28 +0000 (13:48 +0200)
cparser usually depends on a specific libfirm revision,
so it makes sense to target a specific one via submodules.

.gitmodules [new file with mode: 0644]
Makefile
config.mak.example [deleted file]
libfirm [new submodule]

diff --git a/.gitmodules b/.gitmodules
new file mode 100644 (file)
index 0000000..5d57e27
--- /dev/null
@@ -0,0 +1,3 @@
+[submodule "libfirm"]
+       path = libfirm
+       url = http://pp.info.uni-karlsruhe.de/cgi-bin/cgit.cgi/libFirm/
index c4c61cc..5e0fd93 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,14 +1,14 @@
--include config.mak
-
 GOAL = $(BUILDDIR)/cparser
 
 BUILDDIR ?= build
 
-FIRM_CFLAGS ?= `pkg-config --cflags libfirm`
-FIRM_LIBS   ?= `pkg-config --libs libfirm`
+FIRM_HOME   = libfirm
+FIRM_CPPFLAGS = -I$(FIRM_HOME)/include
+FIRM_LIBS   = -lm
+LIBFIRM_FILE = build/debug/libfirm.a
 
 CPPFLAGS  = -I.
-CPPFLAGS += $(FIRM_CFLAGS)
+CPPFLAGS += $(FIRM_CPPFLAGS)
 
 CFLAGS += -Wall -W -Wstrict-prototypes -Wmissing-prototypes -std=c99 -pedantic
 CFLAGS += -O2 -g
@@ -36,6 +36,7 @@ SOURCES := \
        entity.c \
        entitymap.c \
        format_check.c \
+       input.c \
        lexer.c \
        main.c \
        mangle.c \
@@ -46,8 +47,9 @@ SOURCES := \
        type.c \
        type_hash.c \
        types.c \
-       walk_statements.c \
+       help.c \
        warning.c \
+       walk.c \
        wrappergen/write_fluffy.c \
        wrappergen/write_jna.c
 
@@ -94,9 +96,12 @@ revision.h:
 DIRS = build build/adt build/driver build/wrappergen build/cpb build/cpb/adt build/cpb/driver build/cpb/wrappergen build/cpb2 build/cpb2/adt build/cpb2/driver build/cpb2/wrappergen build/cpbe build/cpbe/adt build/cpbe/driver build/cpbe2/wrappergen
 UNUSED := $(shell mkdir -p $(DIRS))
 
-$(GOAL): $(OBJECTS) $(LIBFIRM_FILE)
+$(FIRM_HOME)/$(LIBFIRM_FILE):
+       cd libfirm && $(MAKE) $(LIBFIRM_FILE)
+
+$(GOAL): $(FIRM_HOME)/$(LIBFIRM_FILE) $(OBJECTS)
        @echo "===> LD $@"
-       $(Q)$(CC) $(OBJECTS) $(LFLAGS) -o $(GOAL)
+       $(Q)$(CC) $(OBJECTS) $(LFLAGS) $(FIRM_HOME)/$(LIBFIRM_FILE) -o $(GOAL)
 
 splint: $(SPLINTS)
 
diff --git a/config.mak.example b/config.mak.example
deleted file mode 100644 (file)
index 6648756..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-FIRM_HOME   = $(HOME)/projects/firm
-FIRM_BUILD  = $(FIRM_HOME)/build/i686-pc-linux-gnu/debug/
-FIRM_CFLAGS = -I$(FIRM_HOME)/libfirm/include -I$(FIRM_HOME)/obstack -I$(FIRM_HOME)/libcore -I$(FIRM_HOME)/libcore/libcore -I$(FIRM_HOME)
-FIRM_LIBS   = -L$(FIRM_BUILD) -lfirm -lm -lz
-# used for creating an extra dependency
-LIBFIRM_FILE = $(FIRM_BUILD)/libfirm.a
diff --git a/libfirm b/libfirm
new file mode 160000 (submodule)
index 0000000..5de725e
--- /dev/null
+++ b/libfirm
@@ -0,0 +1 @@
+Subproject commit 5de725ee2658320cb6d38df2be92c692831bbe1d