Hello everybody,
first a request for Brewbuck:
I have similar templates for projects using mixed C/C++, and some more complicated examples of build processes that have more steps in them, if you ever want more examples of makefile tricks.
Can you post some examples for mixed C/C++ ? I seem to have trouble getting something similar. I get the "No rule to make target... error" while I think I do have the rule and the source file correctly. I haven't written a complicated makefile from scratch before, and what I am doing is now is modifying a makefile for a PCIe driver in C generated by Windriver, to introduce some gui and manipulation functions I wrote in C++. Here's an excerpt from the makefile:
Code:
TARGET = adc
SRCS = ../MainControlMenu.cxx ../OffLineDataAnalyzer.cxx ../Dict.cxx ../AdcControl.c ../atlas_lib.c $(WD_BASEDIR)/samples/shared/diag_lib.c $(WD_BASEDIR)/samples/shared/wdc_diag_lib.c
LD = g++
OD = ./
OBJS = $(addsuffix .o, $(addprefix $(OD)/, $(basename $(notdir $(SRCS)))))
all : $(TARGET)
$(TARGET) : $(OBJS)
$(LD) $(LFLAGS) -o $@ $(OBJS) $(ADDITIONAL_LIBS)
MainControlMenu.o : MainControlMenu.cxx
$(CC) -c $(CFLAGS) -o $@ $<
OffLineDataAnalyzer.o : OffLineDataAnalyzer.cxx
$(CC) -c $(CFLAGS) -o $@ $<
Dict.o : Dict.cxx
$(CC) -c $(CFLAGS) -o $@ $<
AdcControl.o : ../AdcControl.cxx
$(CC) -c $(CFLAGS) -o $@ $<
atlas_lib.o : ../atlas_lib.c
$(CC) -c $(CFLAGS) -o $@ $<
diag_lib.o : $(WD_BASEDIR)/samples/shared/diag_lib.c
$(CC) -c $(CFLAGS) -o $@ $<
wdc_diag_lib.o : $(WD_BASEDIR)/samples/shared/wdc_diag_lib.c
$(CC) -c $(CFLAGS) -o $@ $<
I added the cxx files and changed LD to g++. Without the MainControlMenu.cxx and OffLineDataAnalyzer.cxx files it actually works. I mean the main AdcControl.cxx source file compiles ok with the C files and works. I just wanted to shift the main function to the gui and compile together with the other two but i get the error message:
Code:
make: Entering directory `/home/atlas/standaloneGui/linux'
make: *** No rule to make target `MainControlMenu.cxx', needed by `MainControlMenu.o'. Stop.
Does anybody have any advice for this Makefile newbie?
Thanks