From 02aa98967b60c2a1d38f7647c24daa75bf94b7bb Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Mon, 29 Oct 2012 21:36:18 +0100 Subject: [PATCH] Also install the header for libDatabase --- Makefile | 9 ++++-- include/Database.h | 24 +++++++++++++++ include/Database/Makefile | 23 +++++++++++++++ {src/engines => include/Database}/database.h | 0 include/Database/project.conf | 5 ++++ include/Makefile | 31 ++++++++++++++++++++ include/project.conf | 3 ++ project.conf | 2 +- src/Makefile | 4 +-- src/database.c | 2 +- src/engines/Makefile | 12 ++++---- src/engines/project.conf | 13 ++++---- src/project.conf | 3 +- 13 files changed, 112 insertions(+), 19 deletions(-) create mode 100644 include/Database.h create mode 100644 include/Database/Makefile rename {src/engines => include/Database}/database.h (100%) create mode 100644 include/Database/project.conf create mode 100644 include/Makefile create mode 100644 include/project.conf diff --git a/Makefile b/Makefile index e7adc47..5a339dc 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ PACKAGE = libDatabase VERSION = 0.0.0 -SUBDIRS = data src +SUBDIRS = data include src RM ?= rm -f LN ?= ln -f TAR ?= tar -czvf @@ -25,6 +25,12 @@ dist: $(PACKAGE)-$(VERSION)/data/libDatabase.pc.in \ $(PACKAGE)-$(VERSION)/data/pkgconfig.sh \ $(PACKAGE)-$(VERSION)/data/project.conf \ + $(PACKAGE)-$(VERSION)/include/Database.h \ + $(PACKAGE)-$(VERSION)/include/Makefile \ + $(PACKAGE)-$(VERSION)/include/project.conf \ + $(PACKAGE)-$(VERSION)/include/Database/database.h \ + $(PACKAGE)-$(VERSION)/include/Database/Makefile \ + $(PACKAGE)-$(VERSION)/include/Database/project.conf \ $(PACKAGE)-$(VERSION)/src/database.c \ $(PACKAGE)-$(VERSION)/src/Makefile \ $(PACKAGE)-$(VERSION)/src/project.conf \ @@ -34,7 +40,6 @@ dist: $(PACKAGE)-$(VERSION)/src/engines/sqlite3.c \ $(PACKAGE)-$(VERSION)/src/engines/template.c \ $(PACKAGE)-$(VERSION)/src/engines/Makefile \ - $(PACKAGE)-$(VERSION)/src/engines/database.h \ $(PACKAGE)-$(VERSION)/src/engines/project.conf \ $(PACKAGE)-$(VERSION)/Makefile \ $(PACKAGE)-$(VERSION)/config.h \ diff --git a/include/Database.h b/include/Database.h new file mode 100644 index 0000000..b1c066c --- /dev/null +++ b/include/Database.h @@ -0,0 +1,24 @@ +/* $Id$ */ +/* Copyright (c) 2012 Pierre Pronchery */ +/* This file is part of DeforaOS Database libDatabase */ +/* This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 3 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ + + + +#ifndef LIBDATABASE_DATABASE_H +# define LIBDATABASE_DATABASE_H + +# include "Database/database.h" + + +#endif /* !LIBDATABASE_DATABASE_H */ diff --git a/include/Database/Makefile b/include/Database/Makefile new file mode 100644 index 0000000..4af2454 --- /dev/null +++ b/include/Database/Makefile @@ -0,0 +1,23 @@ +PREFIX = /usr/local +DESTDIR = +RM ?= rm -f +LN ?= ln -f +MKDIR ?= mkdir -p +INSTALL ?= install +INCLUDEDIR= $(PREFIX)/include + + +all: + +clean: + +distclean: clean + +install: + $(MKDIR) $(DESTDIR)$(INCLUDEDIR)/Database + $(INSTALL) -m 0644 -- database.h $(DESTDIR)$(INCLUDEDIR)/Database/database.h + +uninstall: + $(RM) -- $(DESTDIR)$(INCLUDEDIR)/Database/database.h + +.PHONY: all clean distclean install uninstall diff --git a/src/engines/database.h b/include/Database/database.h similarity index 100% rename from src/engines/database.h rename to include/Database/database.h diff --git a/include/Database/project.conf b/include/Database/project.conf new file mode 100644 index 0000000..59b9eb8 --- /dev/null +++ b/include/Database/project.conf @@ -0,0 +1,5 @@ +includes=database.h +dist=Makefile + +[database.h] +install=$(INCLUDEDIR)/Database diff --git a/include/Makefile b/include/Makefile new file mode 100644 index 0000000..36e76e0 --- /dev/null +++ b/include/Makefile @@ -0,0 +1,31 @@ +SUBDIRS = Database +PREFIX = /usr/local +DESTDIR = +RM ?= rm -f +LN ?= ln -f +MKDIR ?= mkdir -p +INSTALL ?= install +INCLUDEDIR= $(PREFIX)/include + + +all: subdirs + +subdirs: + @for i in $(SUBDIRS); do (cd $$i && $(MAKE)) || exit; done + +clean: + @for i in $(SUBDIRS); do (cd $$i && $(MAKE) clean) || exit; done + +distclean: + @for i in $(SUBDIRS); do (cd $$i && $(MAKE) distclean) || exit; done + +install: + @for i in $(SUBDIRS); do (cd $$i && $(MAKE) install) || exit; done + $(MKDIR) $(DESTDIR)$(INCLUDEDIR) + $(INSTALL) -m 0644 -- Database.h $(DESTDIR)$(INCLUDEDIR)/Database.h + +uninstall: + @for i in $(SUBDIRS); do (cd $$i && $(MAKE) uninstall) || exit; done + $(RM) -- $(DESTDIR)$(INCLUDEDIR)/Database.h + +.PHONY: all subdirs clean distclean install uninstall diff --git a/include/project.conf b/include/project.conf new file mode 100644 index 0000000..7f71d47 --- /dev/null +++ b/include/project.conf @@ -0,0 +1,3 @@ +subdirs=Database +includes=Database.h +dist=Makefile diff --git a/project.conf b/project.conf index d1eed69..f89cc4e 100644 --- a/project.conf +++ b/project.conf @@ -2,5 +2,5 @@ package=libDatabase version=0.0.0 config=h,sh -subdirs=data,src +subdirs=data,include,src dist=Makefile,config.h diff --git a/src/Makefile b/src/Makefile index 8bb8984..25d42d0 100644 --- a/src/Makefile +++ b/src/Makefile @@ -4,7 +4,7 @@ PREFIX = /usr/local DESTDIR = LIBDIR = $(PREFIX)/lib CC ?= cc -CPPFLAGSF?= +CPPFLAGSF= -I ../include/Database CPPFLAGS?= CFLAGSF = -W -fPIC CFLAGS = -Wall -g -O2 -pedantic @@ -35,7 +35,7 @@ libDatabase.so.0.0 libDatabase.so.0 libDatabase.so: $(libDatabase_OBJS) $(LN) -s -- libDatabase.so.0.0 libDatabase.so.0 $(LN) -s -- libDatabase.so.0.0 libDatabase.so -database.o: database.c engines/database.h +database.o: database.c ../include/Database/database.h $(CC) $(libDatabase_CFLAGS) -c database.c clean: diff --git a/src/database.c b/src/database.c index fac8a7d..8d378e0 100644 --- a/src/database.c +++ b/src/database.c @@ -17,7 +17,7 @@ #include #include -#include "engines/database.h" +#include "database.h" #include "../config.h" diff --git a/src/engines/Makefile b/src/engines/Makefile index 316870e..3a7c419 100644 --- a/src/engines/Makefile +++ b/src/engines/Makefile @@ -3,7 +3,7 @@ PREFIX = /usr/local DESTDIR = LIBDIR = $(PREFIX)/lib CC ?= cc -CPPFLAGSF?= +CPPFLAGSF= -I ../../include/Database CPPFLAGS?= CFLAGSF = -W -fPIC CFLAGS = -Wall -g -O2 -pedantic @@ -53,19 +53,19 @@ template_LDFLAGS = $(LDFLAGSF) $(LDFLAGS) template.so: $(template_OBJS) $(CCSHARED) -o template.so $(template_OBJS) $(template_LDFLAGS) -pdo.o: pdo.c database.h ../../config.h +pdo.o: pdo.c ../../include/Database/database.h ../../config.h $(CC) $(pdo_CFLAGS) -c pdo.c -pgsql.o: pgsql.c database.h +pgsql.o: pgsql.c ../../include/Database/database.h $(CC) $(pgsql_CFLAGS) -c pgsql.c -sqlite2.o: sqlite2.c database.h +sqlite2.o: sqlite2.c ../../include/Database/database.h $(CC) $(sqlite2_CFLAGS) -c sqlite2.c -sqlite3.o: sqlite3.c database.h +sqlite3.o: sqlite3.c ../../include/Database/database.h $(CC) $(sqlite3_CFLAGS) -c sqlite3.c -template.o: template.c database.h +template.o: template.c ../../include/Database/database.h $(CC) $(template_CFLAGS) -c template.c clean: diff --git a/src/engines/project.conf b/src/engines/project.conf index af50192..c957afa 100644 --- a/src/engines/project.conf +++ b/src/engines/project.conf @@ -1,7 +1,8 @@ targets=pdo,pgsql,sqlite2,sqlite3,template +cppflags_force=-I ../../include/Database cflags_force=-W -fPIC cflags=-Wall -g -O2 -pedantic -dist=Makefile,database.h +dist=Makefile [pdo] type=plugin @@ -9,7 +10,7 @@ sources=pdo.c install=$(LIBDIR)/Database/engine [pdo.c] -depends=database.h,../../config.h +depends=../../include/Database/database.h,../../config.h [pgsql] type=plugin @@ -19,7 +20,7 @@ sources=pgsql.c install=$(LIBDIR)/Database/engine [pgsql.c] -depends=database.h +depends=../../include/Database/database.h [sqlite2] type=plugin @@ -29,7 +30,7 @@ sources=sqlite2.c install=$(LIBDIR)/Database/engine [sqlite2.c] -depends=database.h +depends=../../include/Database/database.h [sqlite3] type=plugin @@ -39,11 +40,11 @@ sources=sqlite3.c install=$(LIBDIR)/Database/engine [sqlite3.c] -depends=database.h +depends=../../include/Database/database.h [template] type=plugin sources=template.c [template.c] -depends=database.h +depends=../../include/Database/database.h diff --git a/src/project.conf b/src/project.conf index 9b1f4ad..ac94ac8 100644 --- a/src/project.conf +++ b/src/project.conf @@ -1,5 +1,6 @@ subdirs=engines targets=libDatabase +cppflags_force=-I ../include/Database cflags_force=-W -fPIC cflags=-Wall -g -O2 -pedantic dist=Makefile @@ -9,4 +10,4 @@ type=library sources=database.c [database.c] -depends=engines/database.h +depends=../include/Database/database.h