Re: [code][gurus][mysql]

From: George (greerga@circlemud.org)
Date: 01/10/99


On Sat, 9 Jan 1999, Invincibill wrote:

>the math lib and the mysqlclient lib. using -lm -lmysqlclient
>my question is, in the makefile, is there some easy way to set it up so
>that if the mysql.h is in the object dependencies, it automatically adds
>the -lm and -lmysqlclient? or is there someway to build it so i dont
>need to link them? i'm really clueless when it comes to linking
>libraries and whatnot.(among a good many other things)  i have my
>libraries in my /lib directory and the mysql.h is in the /include
>directory.

Sounds like you need Makefile tricks

$ make MYSQL=y

-- Makefile --

ifeq ($(MYSQL),y)
  CFLAGS += -DUSE_MYSQL=1
  LIBS += -lm -lmysqlclient
endif

-- (files).c --

#ifdef USE_MYSQL
#include <mysql.h>
#endif

--
George Greer
greerga@circlemud.org
http://www.circlemud.org/~greerga/


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST