PDA

View Full Version : [c / c++ - ECLIPSE] importare un makefile in un progetto Eclipse


czar
11-02-2010, 17:06
Allora ho due progetti: uno in c++ realizzato in Eclipse, e un altro in c (che dispone di un makefile) che dovrebbe essere chiamato dal primo progetto, in quanti poi dovrei unirli entrambi in un unico progetto.

Il problema principale nell'importare il makefile penso sia dato dal fatto che il suddetto makefile genera 3 file:

#
# generate scanner and parser from spsecifications
#

scanner.c: scanner.lex
$(LEX) $(LFLAGS) scanner.lex
$(MV) lex.yy.c scanner.c

parser.h: parser.c
parser.c: parser.yacc
$(YACC) $(YFLAGS) parser.yacc
$(MV) y.tab.c parser.c
$(MV) y.tab.h parser.h


fino a che si tratta di includere librerie e .h non è difficile, il problema è dirgli che deve anche generare quei file... sapete darmi una mano?
ho provato anche da riga di comando a dare "make" salvare i 3 file scanner.c, parser.h/c e poi lasciarli nella cartella, ma niente... Alla fin fine compilando con "make" funziona tutto (anche eseguendo il solo make da Eclipse), il problema piu' che altro è che vorrei inserire questo progetto in un altro già creato con Eclipse in c++, quindi non diventa più fattibile che questo pezzo lo compilo col makefile, mentre l'altro pezzo che già avevo realizzato in Eclipse lo compilo settando le opzioni di Eclipse, dovrei riuscire a compilare anche il progetto in C da Eclipse, senza utilizzare il makefile...


per completezza allego tutto il makefile:

# -*- Indented-Text -*-
# ----------------------------------------------------------------------------
# $Id: Makefile.in 29 2007-09-18 10:03:21Z lindig $
# ----------------------------------------------------------------------------

# CONCEPTS
# Copyright (C) 1994 Technical University of Braunschweig, Germany
# Written by Christian Lindig (lindig@ips.cs.tu-bs.de)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

# ---------------------------------------------------------------------------
# NAME and VERSION
# ---------------------------------------------------------------------------

NAME = concepts
VERSION = 0.4

# ---------------------------------------------------------------------------
# system configuration
# ---------------------------------------------------------------------------


VPATH = .
srcdir = $(VPATH)

CC = gcc
CFLAGS = -g -O2 -Wall -pedantic
LDFLAGS = -g

INSTALL = /bin/install -c
INSTALL_PROGRAM = ${INSTALL}
INSTALL_DATA = ${INSTALL} -m 644

LEX = flex
LEXLIB = -lfl

YACC = bison -y
YFLAGS = -d

DEFS = -DHAVE_CONFIG_H
LIBS = -lm $(LEXLIB)

RM = rm -f
MV = mv
DIFF = diff
TAR = tar
GZIP = gzip -f

DEPEND = $(CC) -MM

# ---------------------------------------------------------------------------
# Installation
# ---------------------------------------------------------------------------

prefix = /usr/local
exec_prefix = $(prefix)

bindir = $(exec_prefix)/bin
man1dir = $(prefix)/man/man1
man1ext = .1

# ---------------------------------------------------------------------------
# SHELL
# ---------------------------------------------------------------------------

SHELL = /bin/sh

# ---------------------------------------------------------------------------
# Rules
# ---------------------------------------------------------------------------

.c.o:
$(CC) -c $(CPPFLAGS) $(DEFS) $(CFLAGS) $<

# ---------------------------------------------------------------------------
#
# ---------------------------------------------------------------------------


SRCS = concept.c hash.c list.c mainColibri.c panic.c print.c\
relation.c set.c context.c input.c arrow.c lib.c

HDRS = hash.h list.h concept.h input.h print.h\
relation.h context.h panic.h set.h arrow.h\
lib.h defines.h

OBJS = concept.o hash.o list.o mainColibri.o panic.o print.o\
relation.o set.o context.o input.o arrow.o\
scanner.o parser.o lib.o

DISTFILES = README INSTALL COPYING Makefile.in scanner.lex parser.yacc\
concepts.man test.in test.old install.sh\
configure configure.in config.h.in $(SRCS) $(HDRS) doc/*\
config.h Makefile version.h version.h.in

#
# main target
#

concepts: $(OBJS)
$(CC) $(LDFLAGS) -o concepts $(OBJS) $(LIBS)

#
# generate scanner and parser from spsecifications
#

scanner.c: scanner.lex
$(LEX) $(LFLAGS) scanner.lex
$(MV) lex.yy.c scanner.c

parser.h: parser.c
parser.c: parser.yacc
$(YACC) $(YFLAGS) parser.yacc
$(MV) y.tab.c parser.c
$(MV) y.tab.h parser.h

#
# dependencies for autoconf related files
#

Makefile: Makefile.in configure
./configure

configure: configure.in
autoconf

# ---------------------------------------------------------------------------
# Phony Targets
# ---------------------------------------------------------------------------

install: concepts concepts.man $(bindir) $(man1dir)
$(INSTALL_PROGRAM) concepts $(bindir)
$(INSTALL_DATA) concepts.man $(man1dir)/concepts$(man1ext)

$(bindir):
mkdir -p $@

$(man1dir):
mkdir -p $@

tags: $(SRCS)
etags $(SRCS)

clean:
$(RM) $(OBJS) scanner.c parser.c parser.h Makefile.bak


test: concepts test.in test.old
@./concepts -c -o test.new test.in
@if $(DIFF) test.old test.new ;\
then echo "test passed" ;\
else echo "test failed" ;\
fi

dist: $(DISTFILES)
$(TAR) -cvf $(NAME)-$(VERSION).tar $(DISTFILES)
$(GZIP) $(NAME)-$(VERSION).tar


#
# determine dependencies using "cc -M"
#

depend: $(SRCS) scanner.c parser.c
(cp Makefile Makefile.bak ;\
sed '/^# DO NOT DELETE/q' Makefile.bak > Makefile ;\
$(DEPEND) $(SRCS) scanner.c parser.c >> Makefile)

# DO NOT DELETE THIS LINE -- make depend depends on it.
concept.o: concept.c config.h defines.h panic.h list.h set.h relation.h \
concept.h
hash.o: hash.c config.h defines.h panic.h hash.h
list.o: list.c config.h defines.h panic.h list.h
mainColibri.o: mainColibri.c config.h defines.h version.h panic.h list.h hash.h set.h \
relation.h concept.h context.h arrow.h input.h print.h
panic.o: panic.c config.h defines.h panic.h
print.o: print.c config.h defines.h panic.h set.h list.h hash.h \
relation.h concept.h context.h arrow.h print.h
relation.o: relation.c config.h defines.h panic.h set.h relation.h
set.o: set.c config.h defines.h panic.h set.h
context.o: context.c config.h defines.h panic.h list.h hash.h set.h \
relation.h concept.h context.h
input.o: input.c config.h defines.h panic.h hash.h list.h set.h \
relation.h concept.h context.h input.h
arrow.o: arrow.c config.h defines.h panic.h list.h hash.h set.h \
relation.h concept.h context.h arrow.h
lib.o: lib.c config.h defines.h lib.h
scanner.o: scanner.c config.h defines.h panic.h hash.h list.h set.h \
relation.h concept.h context.h input.h parser.h
parser.o: parser.c config.h defines.h list.h set.h hash.h relation.h \
concept.h context.h input.h


sinceramente sono un po' confuso, spero sappiate aiutarmi ^^'

czar
12-02-2010, 10:29
up :(