Skip to content

Commit

Permalink
Cleanup and simplify Makefiles.
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Donnelly committed Jun 29, 2014
1 parent cb3112c commit 20bfbb3
Show file tree
Hide file tree
Showing 59 changed files with 490 additions and 698 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
*.swp
cctools.test.log
configure.rerun
Makefile.config
config.mk
13 changes: 10 additions & 3 deletions .src.Makefile → .module.mk
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
include ../Makefile.config
include ../Makefile.rules
include ../config.mk
include ../rules.mk

PHONY_TARGETS ?= src
TARGETS ?= $(PHONY_TARGETS)

all: $(TARGETS)

$(TARGETS):
@$(MAKE) -C $@

Expand All @@ -17,4 +19,9 @@ $(INSTALL_TARGETS):
@$(MAKE) -C $(@:install-%=%) install
install: $(INSTALL_TARGETS)

.PHONY: $(PHONY_TARGETS) all clean install test
TEST_TARGETS = $(TARGETS:%=test-%)
$(TEST_TARGETS):
@$(MAKE) -C $(@:test-%=%) test
test: $(TEST_TARGETS)

.PHONY: $(PHONY_TARGETS) $(CLEAN_TARGETS) $(INSTALL_TARGETS) $(TEST_TARGETS) all clean install test
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
include Makefile.config
include Makefile.rules
include config.mk
include rules.mk

all: $(CCTOOLS_PACKAGES)

Makefile.config:
config.mk:
@echo "You must run 'configure' before '${MAKE}'."
@exit 1

chirp work_queue sand allpairs wavefront makeflow ftp_lite parrot resource_monitor resource_monitor_visualizer makeflow_linker: dttools
allpairs chirp ftp_lite makeflow makeflow_linker parrot resource_monitor resource_monitor_visualizer sand wavefront work_queue : dttools

allpairs: sand work_queue
makeflow: chirp work_queue
Expand All @@ -16,7 +16,7 @@ sand: work_queue
wavefront: chirp work_queue
work_queue: chirp

$(CCTOOLS_PACKAGES): Makefile.config
$(CCTOOLS_PACKAGES): config.mk
@$(MAKE) -C $@

CLEAN_PACKAGES = $(CCTOOLS_PACKAGES:%=clean-%)
Expand All @@ -28,8 +28,8 @@ INSTALL_PACKAGES = $(CCTOOLS_PACKAGES:%=install-%)
$(INSTALL_PACKAGES): $(CCTOOLS_PACKAGES)
@$(MAKE) -C $(@:install-%=%) install
install: $(INSTALL_PACKAGES)
mkdir -p ${CCTOOLS_INSTALL_DIR}/etc
cp Makefile.config ${CCTOOLS_INSTALL_DIR}/etc/Makefile.config
mkdir -p ${CCTOOLS_INSTALL_DIR}/{etc,doc}
cp config.mk ${CCTOOLS_INSTALL_DIR}/etc/config.mk
cp COPYING ${CCTOOLS_INSTALL_DIR}/doc

test: $(CCTOOLS_PACKAGES)
Expand Down
15 changes: 0 additions & 15 deletions Makefile.rules

This file was deleted.

2 changes: 1 addition & 1 deletion allpairs/Makefile
4 changes: 2 additions & 2 deletions allpairs/src.tpds/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CCTOOLS_HOME = ../../../

include ${CCTOOLS_HOME}/Makefile.config
include ${CCTOOLS_HOME}/Makefile.rules
include ${CCTOOLS_HOME}/config.mk
include ${CCTOOLS_HOME}/rules.mk

TARGETS = allpairs allpairs_status allpairs_wait allpairs_cleanup

Expand Down
27 changes: 12 additions & 15 deletions allpairs/src/Makefile
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
CCTOOLS_HOME = ../../
include ../../config.mk
include ../../rules.mk

include ${CCTOOLS_HOME}/Makefile.config
include ${CCTOOLS_HOME}/Makefile.rules
LOCAL_LINKAGE = -lpthread

TARGETS = allpairs_multicore allpairs_master
EXTERNAL_DEPENDENCIES = ../../sand/src/libsandtools.a ../../work_queue/src/libwork_queue.a ../../dttools/src/libdttools.a
OBJECTS = allpairs_compare.o
PROGRAMS = allpairs_multicore allpairs_master
TARGETS = $(PROGRAMS)

LOCAL_LDFLAGS=../../sand/src/libsandtools.a -lwork_queue -ldttools ${CCTOOLS_INTERNAL_LDFLAGS}
all: $(TARGETS)

all: ${TARGETS}

allpairs_multicore: allpairs_multicore.o allpairs_compare.o ${CCTOOLS_HOME}/dttools/src/libdttools.a
${CCTOOLS_LD} -o $@ allpairs_multicore.o allpairs_compare.o -lpthread ${LOCAL_LDFLAGS}

allpairs_master: allpairs_master.o allpairs_compare.o ${CCTOOLS_HOME}/dttools/src/libdttools.a
${CCTOOLS_LD} -o $@ allpairs_master.o allpairs_compare.o ${LOCAL_LDFLAGS}
$(PROGRAMS): $(OBJECTS) $(EXTERNAL_DEPENDENCIES)

test:

clean:
rm -f core *~ *.o *.a ${TARGETS}
rm -f $(OBJECTS) $(TARGETS)

install: all
mkdir -p ${CCTOOLS_INSTALL_DIR}/bin
cp ${TARGETS} ${CCTOOLS_INSTALL_DIR}/bin
mkdir -p $(CCTOOLS_INSTALL_DIR)/bin
cp $(PROGRAMS) $(CCTOOLS_INSTALL_DIR)/bin/
4 changes: 2 additions & 2 deletions apps/wq_replica_exchange/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

include ../../Makefile.config
include ../../Makefile.rules
include ../../config.mk
include ../../rules.mk

all:

Expand Down
4 changes: 2 additions & 2 deletions apps/wq_sort/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CCTOOLS_HOME = ../../

include ${CCTOOLS_HOME}/Makefile.config
include ${CCTOOLS_HOME}/Makefile.rules
include ${CCTOOLS_HOME}/config.mk
include ${CCTOOLS_HOME}/rules.mk

PROGRAMS = wq_sort

Expand Down
2 changes: 1 addition & 1 deletion chirp/Makefile
122 changes: 42 additions & 80 deletions chirp/src/Makefile
Original file line number Diff line number Diff line change
@@ -1,92 +1,54 @@
include ../../Makefile.config
include ../../Makefile.rules

LOCAL_LDFLAGS = -ldttools -lchirp ${CCTOOLS_INTERNAL_LDFLAGS}

LIBRARY_SOURCES = chirp_global.c chirp_multi.c chirp_recursive.c chirp_reli.c chirp_client.c chirp_matrix.c chirp_stream.c chirp_ticket.c
SERVER_SOURCES = sqlite3.c chirp_stats.c chirp_thirdput.c chirp_alloc.c chirp_audit.c chirp_acl.c chirp_group.c chirp_filesystem.c chirp_fs_hdfs.c chirp_fs_local.c chirp_fs_local_scheduler.c chirp_fs_chirp.c chirp_ticket.c chirp_job.c

PROGRAMS=chirp chirp_get chirp_put chirp_server chirp_status chirp_benchmark chirp_stream_files chirp_fuse chirp_distribute
SCRIPTS=chirp_audit_cluster chirp_server_hdfs
LIBRARIES=libchirp.a libchirp_client.${CCTOOLS_DYNAMIC_SUFFIX}
PUBLIC_HEADERS=chirp_global.h chirp_multi.h chirp_reli.h chirp_client.h chirp_stream.h chirp_protocol.h chirp_matrix.h chirp_types.h chirp_recursive.h

TARGETS = ${PROGRAMS} ${LIBRARIES}
LIBRARY_OBJECTS = ${LIBRARY_SOURCES:%.c=%.o}
SERVER_OBJECTS = ${SERVER_SOURCES:%.c=%.o}

DTTOOLS_STATIC_LIBRARY = ../../dttools/src/libdttools.a
CHIRP_STATIC_LIBRARY = libchirp.a
STATIC_LIBRARIES = ${CHIRP_STATIC_LIBRARY} ${DTTOOLS_STATIC_LIBRARY}

all: ${TARGETS}
include ../../config.mk
include ../../rules.mk

# We only use sqlite3 multi-process (i.e. no threads). So we can turn off
# SQLITE_THREADSAFE. This disables somewhat costly mutex locks.
sqlite3.o: sqlite3.c
$(CCTOOLS_CC) -o $@ -c -DSQLITE_THREADSAFE=0 $(CCTOOLS_INTERNAL_CCFLAGS) $^
LOCAL_CCFLAGS = -DSQLITE_THREADSAFE=0

CHIRPSO = libchirp_client.$(CCTOOLS_DYNAMIC_SUFFIX)
EXTERNAL_DEPENDENCIES = ../../dttools/src/libdttools.a
LIBRARIES = libchirp.a $(CHIRPSO)
OBJECTS = $(OBJECTS_LIBRARY) $(OBJECTS_SERVER)
OBJECTS_LIBRARY = $(SOURCES_LIBRARY:%.c=%.o)
OBJECTS_SERVER = $(SOURCES_SERVER:%.c=%.o)
PROGRAMS = chirp chirp_get chirp_put chirp_server chirp_status chirp_benchmark chirp_stream_files chirp_fuse chirp_distribute
PUBLIC_HEADERS = chirp_global.h chirp_multi.h chirp_reli.h chirp_client.h chirp_stream.h chirp_protocol.h chirp_matrix.h chirp_types.h chirp_recursive.h
SCRIPTS = chirp_audit_cluster chirp_server_hdfs
SOURCES_LIBRARY = chirp_global.c chirp_multi.c chirp_recursive.c chirp_reli.c chirp_client.c chirp_matrix.c chirp_stream.c chirp_ticket.c
SOURCES_SERVER = sqlite3.c chirp_stats.c chirp_thirdput.c chirp_alloc.c chirp_audit.c chirp_acl.c chirp_group.c chirp_filesystem.c chirp_fs_hdfs.c chirp_fs_local.c chirp_fs_local_scheduler.c chirp_fs_chirp.c chirp_job.c
TARGETS = $(PROGRAMS) $(LIBRARIES)

all: $(TARGETS)

# This object exists primarily to get a linkable object for use by ROOT and
# other systems that want to load Chirp dynamically. Note that we explicitly
# include auth_all.o to force the inclusion of the various authentication
# infrastructures. We remove $(CCTOOLS_EXTERNAL_LINKAGE) because many archives
# we use were not compiled with -fPIC, which is required for shared object
# creation.
$(CHIRPSO): $(OBJECTS_LIBRARY) ../../dttools/src/auth_all.o $(EXTERNAL_DEPENDENCIES)
# $(CCTOOLS_LD) -o $@ -fPIC $(CCTOOLS_DYNAMIC_FLAG) $(CCTOOLS_INTERNAL_LDFLAGS) $(LOCAL_LDFLAGS) $^ $(CCTOOLS_DYNAMIC_AUTH_LIBS)

chirp: chirp_tool.o
$(CCTOOLS_LD) -o $@ $(CCTOOLS_INTERNAL_LDFLAGS) $(LOCAL_LDFLAGS) $^ $(LOCAL_LINKAGE) $(CCTOOLS_EXTERNAL_LINKAGE) $(CCTOOLS_READLINE_LDFLAGS)

# This is the library intended to be used by clients of the system.
libchirp.a: $(OBJECTS_LIBRARY)

libchirp.a: ${LIBRARY_OBJECTS}
${CCTOOLS_AR} rv $@ $^
ranlib $@

# This object exists primarily to get a linkable object for use
# by ROOT and other systems that want to load Chirp dynamically.
# Note that we explicitly include auth_all.o and ${CCTOOLS_DYNAMIC_AUTH_LIBS}
# to force the inclusion of the various authentication infrastructures.

libchirp_client.${CCTOOLS_DYNAMIC_SUFFIX}: ${LIBRARY_OBJECTS} ../../dttools/src/auth_all.o ${DTTOOLS_STATIC_LIBRARY}
${CCTOOLS_LD} ${CCTOOLS_DYNAMIC_FLAG} -o $@ $^ ${CCTOOLS_DYNAMIC_AUTH_LIBS}

chirp: chirp_tool.o ${STATIC_LIBRARIES}
${CCTOOLS_LD} -o $@ $^ ${CCTOOLS_READLINE_LDFLAGS} ${LOCAL_LDFLAGS}

chirp_server: chirp_server.o ${SERVER_OBJECTS} ${STATIC_LIBRARIES}
${CCTOOLS_LD} -o $@ $^ ${LOCAL_LDFLAGS}

chirp_get: chirp_get.o ${STATIC_LIBRARIES}
${CCTOOLS_LD} -o $@ $^ ${LOCAL_LDFLAGS}

chirp_put: chirp_put.o ${STATIC_LIBRARIES}
${CCTOOLS_LD} -o $@ $^ ${LOCAL_LDFLAGS}

chirp_benchmark: chirp_benchmark.o ${STATIC_LIBRARIES}
${CCTOOLS_LD} -o $@ $^ ${LOCAL_LDFLAGS}

chirp_status: chirp_status.o ${STATIC_LIBRARIES}
${CCTOOLS_LD} -o $@ $^ ${LOCAL_LDFLAGS}

chirp_fuse: chirp_fuse.o ${STATIC_LIBRARIES}
${CCTOOLS_LD} -o $@ $^ ${LOCAL_LDFLAGS}

chirp_distribute: chirp_distribute.o ${STATIC_LIBRARIES}
${CCTOOLS_LD} -o $@ $^ ${LOCAL_LDFLAGS}

chirp_matrix_benchmark: chirp_matrix_benchmark.o ${STATIC_LIBRARIES}
${CCTOOLS_LD} -o $@ $^ ${LOCAL_LDFLAGS}

chirp_matrix_roc: chirp_matrix_roc.o ${STATIC_LIBRARIES}
${CCTOOLS_LD} -o $@ $^ ${LOCAL_LDFLAGS}

chirp_matrix_verify: chirp_matrix_verify.o ${STATIC_LIBRARIES}
${CCTOOLS_LD} -o $@ $^ ${LOCAL_LDFLAGS}

chirp_stream_files: chirp_stream_files.o ${STATIC_LIBRARIES}
${CCTOOLS_LD} -o $@ $^ ${LOCAL_LDFLAGS}
chirp_server: $(OBJECTS_SERVER)
$(PROGRAMS): libchirp.a $(EXTERNAL_DEPENDENCIES)

test: all

clean:
rm -f core *~ *.o *.os *.a *.${CCTOOLS_DYNAMIC_SUFFIX} ${TARGETS}
rm -f $(OBJECTS) $(TARGETS)

install: all
mkdir -p ${CCTOOLS_INSTALL_DIR}/bin
mkdir -p ${CCTOOLS_INSTALL_DIR}/lib
mkdir -p ${CCTOOLS_INSTALL_DIR}/include/cctools
if [ -f ${CCTOOLS_INSTALL_DIR}/bin/chirp_server ]; then mv ${CCTOOLS_INSTALL_DIR}/bin/chirp_server ${CCTOOLS_INSTALL_DIR}/bin/chirp_server.old; fi
chmod 755 ${SCRIPTS}
cp ${PROGRAMS} ${SCRIPTS} ${CCTOOLS_INSTALL_DIR}/bin
cp ${LIBRARIES} ${CCTOOLS_INSTALL_DIR}/lib
cp ${PUBLIC_HEADERS} ${CCTOOLS_INSTALL_DIR}/include/cctools
mkdir -p $(CCTOOLS_INSTALL_DIR)/bin
if [ -f $(CCTOOLS_INSTALL_DIR)/bin/chirp_server ]; then mv $(CCTOOLS_INSTALL_DIR)/bin/chirp_server $(CCTOOLS_INSTALL_DIR)/bin/chirp_server.old; fi
chmod 755 $(SCRIPTS)
cp $(PROGRAMS) $(SCRIPTS) $(CCTOOLS_INSTALL_DIR)/bin/
mkdir -p $(CCTOOLS_INSTALL_DIR)/lib
cp $(LIBRARIES) $(CCTOOLS_INSTALL_DIR)/lib/
mkdir -p $(CCTOOLS_INSTALL_DIR)/include/cctools
cp $(PUBLIC_HEADERS) $(CCTOOLS_INSTALL_DIR)/include/cctools/
1 change: 1 addition & 0 deletions chirp/src/chirp.c
33 changes: 14 additions & 19 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ potential_packages="dttools ${include_package_chirp} work_queue ${include_packag

check_multiarch

rm -f Makefile.config
rm -f config.mk
echo "checking for all the things I know how to build..."
for p in $potential_packages
do
Expand All @@ -391,7 +391,6 @@ do
if [ -d `pwd`/$p/src ]
then
internal_ccflags="${internal_ccflags} -I`pwd`/$p/src"
internal_ldflags="${internal_ldflags} -L`pwd`/$p/src"
fi
else
echo "package $p not found (that's ok)"
Expand Down Expand Up @@ -454,14 +453,11 @@ then
then
ccflags="${ccflags} -I${globus_path}/include/${globus_flavor} -DHAS_GLOBUS_GSS"
ldflags="${ldflags} -L${globus_path}/lib"

for library in globus_gss_assist globus_gssapi_gsi globus_gsi_proxy_core globus_gsi_credential globus_gsi_callback globus_oldgaa globus_gsi_sysconfig globus_gsi_cert_utils globus_openssl globus_openssl_error globus_callout globus_proxy_ssl globus_common ltdl
do
library_search ${library}_${globus_flavor} ${globus_path}
done

cctools_dynamic_auth_libs="${cctools_dynamic_auth_libs} -L${globus_path}/lib -lglobus_gss_assist_${globus_flavor}"

external_dynlibs="${external_dynlibs} -lglobus_gss_assist_${globus_flavor}"
elif check_file ${globus_path}/include/globus/globus_common.h
then
ccflags="${ccflags} -I${globus_path}/lib/globus/include -I${globus_path}/include/globus -DHAS_GLOBUS_GSS"
Expand All @@ -470,9 +466,7 @@ then
do
library_search $library ${globus_path}
done

cctools_dynamic_auth_libs="${cctools_dynamic_auth_libs} -L${globus_path}/lib -lglobus_gss_assist"

external_dynlibs="${external_dynlibs} -lglobus_gss_assist"
else
if [ $config_globus_path = yes ]
then
Expand Down Expand Up @@ -720,7 +714,8 @@ then
ccflags="${ccflags} -I${krb5_include_path}"
fi

cctools_dynamic_auth_libs="${cctools_dynamic_auth_libs} -L${krb5_path}/lib -lkrb5"
ldflags="${ldflags} -L${krb5_path}/lib"
external_dynlibs="${external_dynlibs} -lkrb5"

ccflags="${ccflags} -DHAS_KRB5"
else
Expand Down Expand Up @@ -1158,7 +1153,7 @@ EOF
fi


echo "Creating Makefile.config..."
echo "Creating config.mk..."

if [ "$optdebug" = 1 ]; then
CCTOOLS_CC="${ccompiler}"
Expand All @@ -1172,7 +1167,7 @@ else
CCTOOLS_MPI_LD='@echo MPI_LINK $@;'"${mpilinker}"
fi

cat <<EOF >>Makefile.config
cat <<EOF >>config.mk
# Generated at `date` by $USER@`uname -n`
CCTOOLS_INSTALL_DIR=${install_path}
Expand All @@ -1188,12 +1183,13 @@ CCTOOLS_BASE_CXXFLAGS=${ccflags}
CCTOOLS_INTERNAL_CXXFLAGS=${internal_ccflags} \${CCTOOLS_BASE_CXXFLAGS}
CCTOOLS_CXXFLAGS=-I\${CCTOOLS_INSTALL_DIR}/include/cctools \${CCTOOLS_BASE_CXXFLAGS}
CCTOOLS_LD=${CCTOOLS_LD}
CCTOOLS_BASE_LDFLAGS=${ldflags}
CCTOOLS_EXTERNAL_ARCHIVES=${external_archives}
CCTOOLS_EXTERNAL_DYNLIBS=${external_dynlibs}
CCTOOLS_INTERNAL_LDFLAGS=\$(CCTOOLS_BASE_LDFLAGS) ${internal_ldflags} \$(CCTOOLS_EXTERNAL_ARCHIVES) \$(CCTOOLS_EXTERNAL_DYNLIBS)
CCTOOLS_LDFLAGS=-L\${CCTOOLS_INSTALL_DIR}/lib \${CCTOOLS_BASE_LDFLAGS}
CCTOOLS_LD = ${CCTOOLS_LD}
CCTOOLS_BASE_LDFLAGS = ${ldflags}
CCTOOLS_INTERNAL_LDFLAGS = \$(CCTOOLS_BASE_LDFLAGS) ${internal_ldflags}
CCTOOLS_EXTERNAL_ARCHIVES = ${external_archives}
CCTOOLS_EXTERNAL_DYNLIBS = ${external_dynlibs}
CCTOOLS_EXTERNAL_LINKAGE = \$(CCTOOLS_EXTERNAL_ARCHIVES) \$(CCTOOLS_EXTERNAL_DYNLIBS)
CCTOOLS_LDFLAGS = -L\$(CCTOOLS_INSTALL_DIR)/lib \$(CCTOOLS_BASE_LDFLAGS)
CCTOOLS_MPI_LD=${CCTOOLS_MPI_LD}
CCTOOLS_USE_MPI=$usempi
Expand All @@ -1202,7 +1198,6 @@ CCTOOLS_READLINE_LDFLAGS=${cctools_readline_ldflags}
CCTOOLS_DYNAMIC_SUFFIX=${cctools_dynamic_suffix}
CCTOOLS_DYNAMIC_FLAG=${cctools_dynamic_flag}
CCTOOLS_DYNAMIC_AUTH_LIBS=${cctools_dynamic_auth_libs}
CC=\$(CCTOOLS_CC)
CCFLAGS=\$(CCTOOLS_CCFLAGS)
Expand Down
Loading

0 comments on commit 20bfbb3

Please sign in to comment.