build: Out-of-source builds for primary CK distribution.

Out of source regressions target still needs additional work
(because it's not there).
ck_pring
Samy Al Bahra 12 years ago
parent 1a0b4122ec
commit e6e97f3ae5

@ -1,5 +1,7 @@
.PHONY: all check clean dist distclean doc install install-headers regressions uninstall
BUILD_DIR=@BUILD_DIR@
SRC_DIR=@SRC_DIR@
CFLAGS=@CFLAGS@
VERSION=@VERSION@
VERSION_MAJOR=@VERSION_MAJOR@
@ -29,10 +31,11 @@ check: regressions
install-headers:
mkdir -p $(DESTDIR)/$(HEADERS) || exit
cp include/*.h $(DESTDIR)/$(HEADERS) || exit
cp $(SRC_DIR)/include/*.h $(DESTDIR)/$(HEADERS) || exit
chmod 644 $(DESTDIR)/$(HEADERS)/ck_*.h || exit
mkdir -p $(DESTDIR)$(HEADERS)/gcc || exit
cp -r include/gcc/* $(DESTDIR)/$(HEADERS)/gcc || exit
cp -r $(SRC_DIR)/include/gcc/* $(DESTDIR)/$(HEADERS)/gcc || exit
cp include/ck_md.h $(DESTDIR)/ck_md.h || exit
chmod 755 $(DESTDIR)/$(HEADERS)/gcc
chmod 644 $(DESTDIR)/$(HEADERS)/gcc/ck_*.h $(DESTDIR)/$(HEADERS)/gcc/*/ck_*.h || exit
@ -65,17 +68,17 @@ clean:
$(MAKE) -C doc clean
$(MAKE) -C src clean
$(MAKE) -C regressions clean
rm -f *~ *.o *.tar.gz
rm -f $(BUILD_DIR)/*~ $(BUILD_DIR)/*.o $(BUILD_DIR)/*.tar.gz
dist:
git archive --format=tar --prefix=ck-$(VERSION)/ HEAD \
| gzip > ck-$(VERSION).tar.gz
| gzip > $(BUILD_DIR)/ck-$(VERSION).tar.gz
distclean: clean
rm -f include/ck_md.h
rm -f build/regressions.build
rm -f build/ck.build
rm -f build/ck.pc
rm -f Makefile
rm -f doc/Makefile
rm -f $(BUILD_DIR)/include/ck_md.h
rm -f $(BUILD_DIR)/build/regressions.build
rm -f $(BUILD_DIR)/build/ck.build
rm -f $(BUILD_DIR)/build/ck.pc
rm -f $(BUILD_DIR)/Makefile
rm -f $(BUILD_DIR)/doc/Makefile

@ -1,7 +1,9 @@
CC=@CC@
MAKE=make
CFLAGS=@CFLAGS@ -I../include
SRC_DIR=@SRC_DIR@
BUILD_DIR=@BUILD_DIR@
CFLAGS=@CFLAGS@ -I$(SRC_DIR)/include -I$(BUILD_DIR)/include
LDFLAGS=@LDFLAGS@
LD=@LD@
include ../build/ck.build.@PROFILE@
include $(BUILD_DIR)/build/ck.build.@PROFILE@

@ -5,5 +5,6 @@ CFLAGS=@CFLAGS@ -I../../../include -DCORES=@CORES@
LD=@LD@
LDFLAGS=@LDFLAGS@
PTHREAD_CFLAGS=@PTHREAD_CFLAGS@
BUILD_DIR=@BUILD_DIR@
include ../../../build/ck.build.@PROFILE@
include $(BUILD_DIR)/build/ck.build.@PROFILE@

25
configure vendored

@ -97,6 +97,8 @@ generate()
-e "s#@VMA_BITS@#$VMA_BITS_R#g" \
-e "s#@VMA_BITS_VALUE@#$VMA_BITS_VALUE_R#g" \
-e "s#@MM@#$MM#g" \
-e "s#@BUILD_DIR@#$P_PWD#g" \
-e "s#@SRC_DIR@#$BUILD_DIR#g" \
$1 > $2
}
@ -117,6 +119,8 @@ generate_stdout()
echo " POINTER_PACK = $POINTER_PACK_ENABLE"
echo " VMA_BITS = $VMA_BITS"
echo " MEMORY_MODEL = $MM"
echo " BUILD_DIR = $P_PWD"
echo " SRC_DIR = $BUILD_DIR"
echo
echo "Headers will be installed in $HEADERS"
echo "Libraries will be installed in $LIBRARY"
@ -547,12 +551,21 @@ echo "success"
printf "Generating build files..........."
generate doc/Makefile.in doc/Makefile
generate build/ck.build.in build/ck.build
generate build/regressions.build.in build/regressions.build
generate build/ck.pc.in build/ck.pc
generate build/ck.spec.in build/ck.spec
generate Makefile.in Makefile
mkdir -p $P_PWD/doc
mkdir -p $P_PWD/build
mkdir -p $P_PWD/include
mkdir -p $P_PWD/src
cp $BUILD_DIR/build/ck.build.$PROFILE $P_PWD/build/ck.build.$PROFILE &> /dev/null
cp $BUILD_DIR/include/ck_md.h $P_PWD/include/ck_md.h &> /dev/null
generate src/Makefile.in $P_PWD/src/Makefile
generate doc/Makefile.in $P_PWD/doc/Makefile
generate build/ck.build.in $P_PWD/build/ck.build
generate build/regressions.build.in $P_PWD/build/regressions.build
generate build/ck.pc.in $P_PWD/build/ck.pc
generate build/ck.spec.in $P_PWD/build/ck.spec
generate Makefile.in $P_PWD/Makefile
echo "success"
generate_stdout

@ -3,6 +3,9 @@
MANDIR=@MANDIR@
GZIP=@GZIP@
GZIP_SUFFIX=.3@GZIP_SUFFIX@
BUILD_DIR=@BUILD_DIR@
SRC_DIR=@SRC_DIR@
OBJECTS=ck_ht_count \
ck_ht_destroy \
ck_ht_get_spmc \
@ -76,7 +79,7 @@ OBJECTS=ck_ht_count \
all:
for target in $(OBJECTS); do \
$(GZIP) $$target > $$target$(GZIP_SUFFIX); \
$(GZIP) $(SRC_DIR)/doc/$$target > $(BUILD_DIR)/doc/$$target$(GZIP_SUFFIX); \
done
install:
@ -85,9 +88,9 @@ install:
uninstall:
for target in $(OBJECTS); do \
rm -f $(DESTDIR)/$(MANDIR)/man3/$$target; \
rm -f $(DESTDIR)/$(MANDIR)/man3/$$target$(GZIP_SUFFIX); \
done
clean:
rm -f *~ *.o *.3.gz
rm -f $(BUILD_DIR)/doc/*~ $(BUILD_DIR)/doc/*.3.gz

@ -1,56 +0,0 @@
.PHONY: clean distribution
OBJECTS=ck_barrier_centralized.o \
ck_barrier_combining.o \
ck_barrier_dissemination.o \
ck_barrier_tournament.o \
ck_barrier_mcs.o \
ck_epoch.o \
ck_ht.o \
ck_hp.o \
ck_bag.o \
ck_hs.o
all: libck.so libck.a
libck.so: $(OBJECTS)
$(LD) $(LDFLAGS) -o libck.so $(OBJECTS)
libck.a: $(OBJECTS)
ar rcs libck.a $(OBJECTS)
ck_bag.o: ../include/ck_bag.h ck_bag.c
$(CC) $(CFLAGS) -c -o ck_bag.o ck_bag.c
ck_epoch.o: ../include/ck_epoch.h ck_epoch.c
$(CC) $(CFLAGS) -c -o ck_epoch.o ck_epoch.c
ck_hs.o: ../include/ck_hs.h ck_hs.c
$(CC) $(CFLAGS) -c -o ck_hs.o ck_hs.c
ck_ht.o: ../include/ck_ht.h ck_ht.c
$(CC) $(CFLAGS) -c -o ck_ht.o ck_ht.c
ck_hp.o: ck_hp.c
$(CC) $(CFLAGS) -c -o ck_hp.o ck_hp.c
ck_barrier_centralized.o: ck_barrier_centralized.c
$(CC) $(CFLAGS) -c -o ck_barrier_centralized.o ck_barrier_centralized.c
ck_barrier_combining.o: ck_barrier_combining.c
$(CC) $(CFLAGS) -c -o ck_barrier_combining.o ck_barrier_combining.c
ck_barrier_dissemination.o: ck_barrier_dissemination.c
$(CC) $(CFLAGS) -c -o ck_barrier_dissemination.o ck_barrier_dissemination.c
ck_barrier_tournament.o: ck_barrier_tournament.c
$(CC) $(CFLAGS) -c -o ck_barrier_tournament.o ck_barrier_tournament.c
ck_barrier_mcs.o: ck_barrier_mcs.c
$(CC) $(CFLAGS) -c -o ck_barrier_mcs.o ck_barrier_mcs.c
clean:
rm -rf *.dSYM *~ *.o $(OBJECTS) libck.a libck.so
include ../build/ck.build
CFLAGS+=-fPIC

@ -0,0 +1,63 @@
.PHONY: clean distribution
include @BUILD_DIR@/build/ck.build
CFLAGS+=-fPIC
TARGET_DIR=$(BUILD_DIR)/src
SDIR=$(SRC_DIR)/src
INCLUDE_DIR=$(SRC_DIR)/include
OBJECTS=ck_barrier_centralized.o \
ck_barrier_combining.o \
ck_barrier_dissemination.o \
ck_barrier_tournament.o \
ck_barrier_mcs.o \
ck_epoch.o \
ck_ht.o \
ck_hp.o \
ck_bag.o \
ck_hs.o
all: libck.so libck.a
libck.so: $(OBJECTS)
echo $(TARGET_DIR)
$(LD) $(LDFLAGS) -o $(TARGET_DIR)/libck.so $(OBJECTS)
libck.a: $(OBJECTS)
ar rcs $(TARGET_DIR)/libck.a $(OBJECTS)
ck_bag.o: $(INCLUDE_DIR)/ck_bag.h $(SDIR)/ck_bag.c
$(CC) $(CFLAGS) -c -o $(TARGET_DIR)/ck_bag.o $(SDIR)/ck_bag.c
ck_epoch.o: $(INCLUDE_DIR)/ck_epoch.h $(SDIR)/ck_epoch.c
$(CC) $(CFLAGS) -c -o $(TARGET_DIR)/ck_epoch.o $(SDIR)/ck_epoch.c
ck_hs.o: $(INCLUDE_DIR)/ck_hs.h $(SDIR)/ck_hs.c
$(CC) $(CFLAGS) -c -o $(TARGET_DIR)/ck_hs.o $(SDIR)/ck_hs.c
ck_ht.o: $(INCLUDE_DIR)/ck_ht.h $(SDIR)/ck_ht.c
$(CC) $(CFLAGS) -c -o $(TARGET_DIR)/ck_ht.o $(SDIR)/ck_ht.c
ck_hp.o: $(SDIR)/ck_hp.c
$(CC) $(CFLAGS) -c -o $(TARGET_DIR)/ck_hp.o $(SDIR)/ck_hp.c
ck_barrier_centralized.o: $(SDIR)/ck_barrier_centralized.c
$(CC) $(CFLAGS) -c -o $(TARGET_DIR)/ck_barrier_centralized.o $(SDIR)/ck_barrier_centralized.c
ck_barrier_combining.o: $(SDIR)/ck_barrier_combining.c
$(CC) $(CFLAGS) -c -o $(TARGET_DIR)/ck_barrier_combining.o $(SDIR)/ck_barrier_combining.c
ck_barrier_dissemination.o: $(SDIR)/ck_barrier_dissemination.c
$(CC) $(CFLAGS) -c -o $(TARGET_DIR)/ck_barrier_dissemination.o $(SDIR)/ck_barrier_dissemination.c
ck_barrier_tournament.o: $(SDIR)/ck_barrier_tournament.c
$(CC) $(CFLAGS) -c -o $(TARGET_DIR)/ck_barrier_tournament.o $(SDIR)/ck_barrier_tournament.c
ck_barrier_mcs.o: $(SDIR)/ck_barrier_mcs.c
$(CC) $(CFLAGS) -c -o $(TARGET_DIR)/ck_barrier_mcs.o $(SDIR)/ck_barrier_mcs.c
clean:
rm -rf $(TARGET_DIR)/*.dSYM $(TARGET_DIR)/*~ $(TARGET_DIR)/*.o \
$(OBJECTS) $(TARGET_DIR)/libck.a $(TARGET_DIR)/libck.so
Loading…
Cancel
Save