I am trying to compile a C library for genetic programming called lil-gp.
I do not know if this kind of questions are appropriate to ask here but i am seeking serious help about this.
The makefile resides under the directory lilgp1.1/1.1/kernel and named as GNUmakefile.kernel. And it looks like this:
kobjects = main.o gp.o eval.o tree.o change.o crossovr.o reproduc.o \
mutate.o select.o tournmnt.o bstworst.o fitness.o genspace.o \
exch.o populate.o ephem.o ckpoint.o event.o pretty.o individ.o \
params.o random.o memory.o output.o
kheaders = event.h defines.h types.h protos.h protoapp.h
.PHONY : all clean
LIBS += -lm
CFLAGS += -I. -I$(KERNELDIR)
all : $(TARGET)
lilgp.h = $(addprefix $(KERNELDIR)/,$(kheaders)) $(uheaders)
$(kobjects) : %.o : $(KERNELDIR)/%.c
$(CC) -c $(CFLAGS) $< -o $@
$(uobjects) : %.o : %.c
$(CC) -c $(CFLAGS) $< -o $@
$(kobjects) $(uobjects) : $(lilgp.h)
$(TARGET) : $(kobjects) $(uobjects)
$(CC) $(LFLAGS) -o $@ $^ $(LIBS)
clean :
\rm -f $(kobjects) $(uobjects) core
As a first move I followed these steps:
- I renamed it as
Makefile - Second i moved
all : $(TARGET)just above to theclean: ...
But GNU make complains me that :
make: *** No rule to make target `/main.c', needed by `main.o'. Stop.
Simple answer: read the documentation that’s included in the package (especially chapters 3 and 6).
Longer answer: if you would have read the documentation, you would have known that you’re not supposed to use
GNUmakefile.kerneldirectly. You need to choose one of the sample apps in the package and run make in its directory. Each one of the apps directories contains a (short)GNUmakefilethat includesGNUmakefile.kernel.Alternatively, you can implement your own problem, by providing your own top level Makefile.