git » libjio » commit 6e8652b

Move the C library files to a new directory

author Alberto Bertogli
2009-03-28 05:07:31 UTC
committer Alberto Bertogli
2009-03-28 05:13:18 UTC
parent f949b1d28af9394f734f3e5243a3a6d58f850aca

Move the C library files to a new directory

This patch moves the C library files to a new directory, called libjio, to
make the directory layout more tidy and to simplify the build system.

As a side-effect of the move, the preloader library now has its own
Makefile.

Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>

Makefile +11 -92
bindings/preload/Makefile +39 -0
libjio/Makefile +91 -0
ansi.c => libjio/ansi.c +0 -0
check.c => libjio/check.c +0 -0
checksum.c => libjio/checksum.c +0 -0
common.c => libjio/common.c +0 -0
common.h => libjio/common.h +0 -0
fiu-local.h => libjio/fiu-local.h +0 -0
jiofsck.c => libjio/jiofsck.c +0 -0
{doc => libjio}/libjio.3 +0 -0
libjio.h => libjio/libjio.h +0 -0
libjio.skel.pc => libjio/libjio.skel.pc +0 -0
trans.c => libjio/trans.c +0 -0
unix.c => libjio/unix.c +0 -0

diff --git a/Makefile b/Makefile
index 97948da..3c32641 100644
--- a/Makefile
+++ b/Makefile
@@ -1,87 +1,14 @@
 
-VERSION="0.24"
-
-CFLAGS = -std=c99 -pedantic -Wall -O3
-
-MANDATORY_CFLAGS := \
-	-D_LARGEFILE_SOURCE=1 $(shell getconf LFS_CFLAGS 2>/dev/null) \
-	-D_XOPEN_SOURCE=500
-
-MANDATORY_LDFLAGS := $(shell getconf LFS_LIBS 2>/dev/null)
-
-ALL_CFLAGS += $(CFLAGS) $(MANDATORY_CFLAGS) -fPIC
-ALL_LDFLAGS += $(LDFLAGS) $(MANDATORY_LDFLAGS) -fPIC
-
-LIBS = -lpthread
-
-ifdef DEBUG
-ALL_CFLAGS += -g
-endif
-
-ifdef PROFILE
-ALL_CFLAGS += -g -pg -fprofile-arcs -ftest-coverage
-endif
-
-ifdef FI
-ALL_CFLAGS += -DFIU_ENABLE=1
-LIBS += -lfiu
-endif
-
-# prefix for installing the binaries
-PREFIX=/usr/local
-
-
-ifneq ($(V), 1)
-        NICE_CC = @echo "  CC  $@"; $(CC)
-        NICE_AR = @echo "  AR  $@"; $(AR)
-else
-        NICE_CC = $(CC)
-        NICE_AR = $(AR)
-endif
-
-
-# objects to build
-OBJS = checksum.o common.o trans.o check.o unix.o ansi.o
-
-# rules
 default: all
 
-all: libjio.so libjio.a libjio.pc jiofsck
+all: libjio
 
-libjio.so: $(OBJS)
-	$(NICE_CC) -shared $(ALL_LDFLAGS) $(LIBS) $(OBJS) -o libjio.so
 
-libjio.a: $(OBJS)
-	$(NICE_AR) cr libjio.a $(OBJS)
+libjio:
+	$(MAKE) -C libjio/
 
-libjio.pc: libjio.skel.pc
-	@echo "generating libjio.pc"
-	@cat libjio.skel.pc | \
-		sed 's@++PREFIX++@$(PREFIX)@g' | \
-		sed 's@++CFLAGS++@$(MANDATORY_CFLAGS)@g' \
-		> libjio.pc
-
-jiofsck: jiofsck.o libjio.a
-	$(NICE_CC) $(ALL_LDFLAGS) jiofsck.o libjio.a $(LIBS) -o jiofsck
-
-install: all
-	install -d $(PREFIX)/lib
-	install -m 0755 libjio.so $(PREFIX)/lib
-	install -m 0644 libjio.a $(PREFIX)/lib
-	install -d $(PREFIX)/include
-	install -m 0644 libjio.h $(PREFIX)/include
-	install -d $(PREFIX)/lib/pkgconfig
-	install -m 644 libjio.pc $(PREFIX)/lib/pkgconfig
-	install -d $(PREFIX)/bin
-	install -m 0775 jiofsck $(PREFIX)/bin
-	install -d $(PREFIX)/man/man3
-	install -m 0644 doc/libjio.3 $(PREFIX)/man/man3/
-	@echo
-	@echo "Please run ldconfig to update your library cache"
-	@echo
-
-.c.o:
-	$(NICE_CC) $(ALL_CFLAGS) $(INCLUDES) -c $< -o $@
+install:
+	$(MAKE) -C libjio/ install
 
 
 python2:
@@ -97,29 +24,21 @@ python3_install: python3
 	cd bindings/python3 && python3 setup.py install
 
 
-
-preload: all
-	install -d bindings/preload/build/
-	$(NICE_CC) $(INCLUDES) -Wall -O3 -shared -fPIC \
-		-D_XOPEN_SOURCE=500 \
-		-ldl -lpthread -L. -ljio -I. \
-		bindings/preload/libjio_preload.c \
-		-o bindings/preload/build/libjio_preload.so
+preload:
+	$(MAKE) -C bindings/preload/
 
 preload_install: preload
-	install -d $(PREFIX)/lib
-	install -m 0755 bindings/preload/build/libjio_preload.so $(PREFIX)/lib
+	$(MAKE) -C bindings/preload/ install
 
 
 clean:
-	rm -f $(OBJS) libjio.a libjio.so libjio.pc jiofsck.o jiofsck
-	rm -f *.bb *.bbg *.da *.gcov *.gcno *.gcda gmon.out
+	$(MAKE) -C libjio/ clean
+	$(MAKE) -C bindings/preload clean
 	rm -rf bindings/python2/build/
 	rm -rf bindings/python3/build/
-	rm -rf bindings/preload/build/
 
 
-.PHONY: default all install \
+.PHONY: default all libjio install \
 	python2 python2_install python3 python3_install \
 	preload preload_install \
 	clean
diff --git a/bindings/preload/Makefile b/bindings/preload/Makefile
new file mode 100644
index 0000000..bfe34b7
--- /dev/null
+++ b/bindings/preload/Makefile
@@ -0,0 +1,39 @@
+
+CFLAGS = -Wall -O3
+
+MANDATORY_CFLAGS := \
+	-D_LARGEFILE_SOURCE=1 $(shell getconf LFS_CFLAGS 2>/dev/null) \
+	-D_XOPEN_SOURCE=500
+
+ALL_CFLAGS = $(CFLAGS) $(MANDATORY_CFLAGS) -fPIC
+
+
+PREFIX = /usr/local
+
+ifneq ($(V), 1)
+        NICE_CC = @echo "  CC  $@"; $(CC)
+else
+        NICE_CC = $(CC)
+endif
+
+
+default: all
+
+all: preload
+
+preload: libjio_preload.o
+	$(NICE_CC) $(ALL_CFLAGS) -ljio -shared -fPIC \
+		libjio_preload.o -o libjio_preload.so
+
+.c.o:
+	$(NICE_CC) $(ALL_CFLAGS) -c $< -o $@
+
+install: preload
+	install -d $(PREFIX)/lib
+	install -m 0755 libjio_preload.so $(PREFIX)/lib
+
+clean:
+	rm -f libjio_preload.o libjio_preload.so
+
+.PHONY: default all install clean
+
diff --git a/libjio/Makefile b/libjio/Makefile
new file mode 100644
index 0000000..be29891
--- /dev/null
+++ b/libjio/Makefile
@@ -0,0 +1,91 @@
+
+CFLAGS = -std=c99 -pedantic -Wall -O3
+
+MANDATORY_CFLAGS := \
+	-D_LARGEFILE_SOURCE=1 $(shell getconf LFS_CFLAGS 2>/dev/null) \
+	-D_XOPEN_SOURCE=500
+
+MANDATORY_LDFLAGS := $(shell getconf LFS_LIBS 2>/dev/null)
+
+ALL_CFLAGS += $(CFLAGS) $(MANDATORY_CFLAGS) -fPIC
+ALL_LDFLAGS += $(LDFLAGS) $(MANDATORY_LDFLAGS) -fPIC
+
+LIBS = -lpthread
+
+ifdef DEBUG
+ALL_CFLAGS += -g
+endif
+
+ifdef PROFILE
+ALL_CFLAGS += -g -pg -fprofile-arcs -ftest-coverage
+endif
+
+ifdef FI
+ALL_CFLAGS += -DFIU_ENABLE=1
+LIBS += -lfiu
+endif
+
+# prefix for installing the binaries
+PREFIX = /usr/local
+
+
+ifneq ($(V), 1)
+        NICE_CC = @echo "  CC  $@"; $(CC)
+        NICE_AR = @echo "  AR  $@"; $(AR)
+else
+        NICE_CC = $(CC)
+        NICE_AR = $(AR)
+endif
+
+
+# objects to build
+OBJS = checksum.o common.o trans.o check.o unix.o ansi.o
+
+# rules
+default: all
+
+all: libjio.so libjio.a libjio.pc jiofsck
+
+libjio.so: $(OBJS)
+	$(NICE_CC) -shared $(ALL_LDFLAGS) $(LIBS) $(OBJS) -o libjio.so
+
+libjio.a: $(OBJS)
+	$(NICE_AR) cr libjio.a $(OBJS)
+
+libjio.pc: libjio.skel.pc
+	@echo "generating libjio.pc"
+	@cat libjio.skel.pc | \
+		sed 's@++PREFIX++@$(PREFIX)@g' | \
+		sed 's@++CFLAGS++@$(MANDATORY_CFLAGS)@g' \
+		> libjio.pc
+
+jiofsck: jiofsck.o libjio.a
+	$(NICE_CC) $(ALL_LDFLAGS) jiofsck.o libjio.a $(LIBS) -o jiofsck
+
+install: all
+	install -d $(PREFIX)/lib
+	install -m 0755 libjio.so $(PREFIX)/lib
+	install -m 0644 libjio.a $(PREFIX)/lib
+	install -d $(PREFIX)/include
+	install -m 0644 libjio.h $(PREFIX)/include
+	install -d $(PREFIX)/lib/pkgconfig
+	install -m 644 libjio.pc $(PREFIX)/lib/pkgconfig
+	install -d $(PREFIX)/bin
+	install -m 0775 jiofsck $(PREFIX)/bin
+	install -d $(PREFIX)/man/man3
+	install -m 0644 libjio.3 $(PREFIX)/man/man3/
+	@echo
+	@echo "Please run ldconfig to update your library cache"
+	@echo
+
+.c.o:
+	$(NICE_CC) $(ALL_CFLAGS) -c $< -o $@
+
+
+clean:
+	rm -f $(OBJS) libjio.a libjio.so libjio.pc jiofsck.o jiofsck
+	rm -f *.bb *.bbg *.da *.gcov *.gcno *.gcda gmon.out
+
+
+.PHONY: default all install clean
+
diff --git a/ansi.c b/libjio/ansi.c
similarity index 100%
rename from ansi.c
rename to libjio/ansi.c
diff --git a/check.c b/libjio/check.c
similarity index 100%
rename from check.c
rename to libjio/check.c
diff --git a/checksum.c b/libjio/checksum.c
similarity index 100%
rename from checksum.c
rename to libjio/checksum.c
diff --git a/common.c b/libjio/common.c
similarity index 100%
rename from common.c
rename to libjio/common.c
diff --git a/common.h b/libjio/common.h
similarity index 100%
rename from common.h
rename to libjio/common.h
diff --git a/fiu-local.h b/libjio/fiu-local.h
similarity index 100%
rename from fiu-local.h
rename to libjio/fiu-local.h
diff --git a/jiofsck.c b/libjio/jiofsck.c
similarity index 100%
rename from jiofsck.c
rename to libjio/jiofsck.c
diff --git a/doc/libjio.3 b/libjio/libjio.3
similarity index 100%
rename from doc/libjio.3
rename to libjio/libjio.3
diff --git a/libjio.h b/libjio/libjio.h
similarity index 100%
rename from libjio.h
rename to libjio/libjio.h
diff --git a/libjio.skel.pc b/libjio/libjio.skel.pc
similarity index 100%
rename from libjio.skel.pc
rename to libjio/libjio.skel.pc
diff --git a/trans.c b/libjio/trans.c
similarity index 100%
rename from trans.c
rename to libjio/trans.c
diff --git a/unix.c b/libjio/unix.c
similarity index 100%
rename from unix.c
rename to libjio/unix.c