[NBLUG/talk] GNU Makefile

Omar Eljumaily omar at omnicode.com
Sat Sep 6 06:17:15 PDT 2014


Does anybody know about GNU Makfiles?  I'm trying to make a Milter that 
checks for recently listed domains, from which I'm getting a lot of 
spam.  If I link using a command line, it links fine, but if I use a 
Makefile it doesn't recognize the objects in libDBLeaper.a. I'm guessing 
it has something to do with mixing c & c++ code, where it does some sort 
of name mangling and doesn't recognize the original form.

Thanks,

Omar

EXENAME = omilter
LDFLAGS = -lmilter -lresolv -L/usr/lib/libmilter/
INCLUDES = -I../DBLeaper
CPP = g++
INCFLAGS =
CPPFLAGS =
CFLAGS += -pipe -Wall -pedantic -O2 -fstack-protector-all -D_REENTRANT
DEBUGCFLAGS = -pipe -Wall -pedantic -Werror -ggdb 
-Wno-error=unused-variable -fstack-protector-all
LIBS = ../DBLeaper/lib/libDBLeaper.a -lstdc++ -ldl

objs=\
mbq.o m1.o\

all: $(objs)
     $(CPP) $(CFLAGS) $(LDFLAGS) $(LIBS) $(objs)  -o $(EXENAME)

%.o : %.cpp
     $(CPP) $(CPPFLAGS) $(INCLUDES) -c $<

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

debug:
     $(CC) $(DEBUGCFLAGS) $(INCFLAGS) $(LDFLAGS) *.c  -o $(EXENAME)-debug

clean:
     rm -f $(EXENAME) $(EXENAME)-debug $(objs) $(OBJECTS)





More information about the talk mailing list