Hi,

ich schreibe momentan an einem Programm, das nun ein *optionales* GUI bekommen soll.
Die Frage ist nun, wie muss eine Makefile aussehen, damit ich über die Makefile steuern kann, ob der Code für das GUI mitkompiliert wird?
Der Code ist in 2 Dateien, gui.c und gui.h enthalten. gui.h wird in einer einzigen anderen Datei per #include eingebunden.

Mein Ziel ist es nun, ein "make" und ein "make no-gui" zu bekommen, in letzterem soll die GUI nicht mitkompiliert werden. (Um auch Systeme ohne X nutzen zu können)

Weiterer Haken: Für die GUI brauche ich CFLAGS und LIBS, die in der no-gui-Version ebenfalls nicht genutzt werden sollen.

Das Ganze ist ein Linuxprojekt, nur falls das noch etwas zur Sache tut.

Hier mal meine aktuelle Makefile:

Code:
CC = gcc
INSTALL = install
LIBS = `pkg-config --libs gtk+-2.0`
CFLAGS = -O2 -D_FILE_OFFSET_BITS=64 `pkg-config --cflags gtk+-2.0`

TARGET = chpchk
SRCS = intel.c amd.c toolkit.c gui.c chpchk.c
OBJS = intel.o amd.o toolkit.o gui.o chpchk.o
BLBS = intel_data.o amd_data.o

all: $(TARGET)

install: $(TARGET)
	$(INSTALL) -s -m 0755 $(TARGET) /usr/bin/$(TARGET)

suid-install: $(TARGET)
	$(INSTALL) -s -o root -g root -m 4755 $(TARGET) /usr/bin/$(TARGET)

intel_data.o:
	ld -r -b binary -o intel_data.o intel.csv
amd_data.o:
	ld -r -b binary -o amd_data.o amd.csv

$(TARGET): $(BLBS) $(OBJS)
	$(CC) -o $(TARGET) $(OBJS) $(BLBS) $(LIBS)

%.o: %.c
	$(CC) -o $@ -c $< $(CFLAGS)

clean:
	rm -f $(OBJS) $(BLBS) core $(TARGET)

strip:
	strip $(TARGET)
Alles was fett markiert ist, soll in der no-gui-Version aussen vor bleiben.

Wie stelle ich das Ganze an?
Ich habe mit Makefiles bisher kaum Erfahrung (ist um genau zu sein meine Erste).
Und wie schon gesagt, ich habe auch keine Ahnung, wie ich die #include gui.h-Zeile im Code dann "deaktivieren" kann...

Wäre für Hilfe extrem dankbar!!!

Peter