Makefile - Includes für MySQL hinzufügen



  • Hi,
    ich schreibe zur Zeit an einem Apache 2.0 Modul in C, was auch schon einigermaßen läuft. Da ich noch nicht lang unter Linux und C programmiere, weiß ich noch nicht so richtig wie das mit autoconf, automake etc. funktioniert. Deshalb hab ich mein Modul auf mod_line_edit aufgebaut, bzw. verwende eigentlich nur noch die Makefile davon.

    Jetzt will ich jedoch MySQL-Unterstützung zu meinem Modul hinzufügen, wofür ich aber den Pfad "/usr/include/mysql" mit includen müsste.

    Wenn ich eine normale Konsolen-Anwendung (also kein Apache Modul) mit MySQL-Unterstützung kompilieren würde, würde ich das so machen:

    gcc -c -I/usr/include/mysql mysql.c
    gcc -o mysql mysql.o -L/usr/lib/mysql -lmysqlclient
    

    Allerdings sieht meine Makefile jetzt so aus, und ich weiß nicht wo ich dort die Includes einbauen muss:

    ##
    ##  Makefile -- Build procedure for mod_layerad Apache module
    ##
    builddir=$(shell pwd)
    top_srcdir=/usr/share/apache2
    #usr/local/apache2
    top_builddir=/usr/share/apache2
    #usr/local/apache2
    include /usr/share/apache2/build/special.mk
    #usr/local/apache2/build/special.mk
    
    #   the used tools
    APXS=/usr/bin/apxs2
    APACHECTL=apache2ctl
    CC=`$(APXS) -q CC`
    INC=-I`$(APXS) -q INCLUDEDIR` `$(APXS) -q CFLAGS`  #-DLAYOUT_FILEOWNER_NAME
    LD_SHLIB=`apxs -q LDFLAGS_SHLIB`
    VERSION = 1.0.0
    DISTNAME = mod_layerad
    DISTVNAME = $(DISTNAME)-$(VERSION)
    
    SRC = mod_layerad.c
    OBJ = ${SRC:.c=.o}
    SOBJ = ${SRC:.c=.lo}
    
    SHELL = /bin/sh
    PERL = perl
    NOOP = $(SHELL) -c true
    RM_RF = rm -rf
    SUFFIX = .gz
    COMPRESS = gzip --best
    TAR  = tar
    TARFLAGS = cvf
    PREOP = @$(NOOP)
    POSTOP = @$(NOOP)
    TO_UNIX = @$(NOOP)
    
    #   additional defines, includes and libraries
    # Apache itself won't compile with it this strict
    #DEF = -Wall -DDEBUG -Wtraditional -Wshadow -Wid-clash-len -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings-Wconversion -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wlong-long -Winline -Werror
    #DEF = -Wall -DDEBUG 
    
    #   the default target
    all: mod_layerad.so
    
    #   compile the shared object file
    #mod_layout.so: $(OBJ)  Makefile
    mod_layerad.so: $(OBJ)
    	$(APXS) -o liblayerad.la -c $(SOBJ)
    	#$(APXS) -c -o liblayerad $(SOBJ)
    	#$(APXS) -i -a mod_layerad.la
    
    mod_layerad.o : mod_layerad.c
    	$(APXS) -c mod_layerad.c
    
    #   install the shared object file into Apache 
    install: 
    	$(APXS) -i -n liblayerad.so -e liblayerad.la
    	@echo "+--------------------------------------------------------+"; \
    	echo "| All done.                                              |"; \
    	echo "|                                                        |"; \
    	echo "| You will need to add the directive:                    |"; \
    	echo "| LoadModule layerad_module modules/liblayerad.so        |"; \
    	echo "|                                                        |"; \
    	echo "| So that you can begin to use mod_layerad.              |"; \
    	echo "|                                                        |"; \
    	echo "| Thanks for installing mod_layerad.                     |"; \
    	echo "+--------------------------------------------------------+"; \
    
    #   cleanup
    clean:
    	rm -f mod_layerad.o mod_layerad.so $(OBJ) *.gz *rpm
    

    Bin für jede Hilfe dankbar.
    Jonas



  • würde auf die Zeile mit INC tippen


Anmelden zum Antworten