Skip to content

Commit

Permalink
Updating makefiles to improve run/check process
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesaross committed Dec 20, 2017
1 parent 8f980e6 commit 21ce87d
Show file tree
Hide file tree
Showing 10 changed files with 80 additions and 3 deletions.
40 changes: 40 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
SUBDIRS = src example test

COPRCC := $(shell command -v coprcc 2> /dev/null)
ifndef COPRCC
$(warning Building libshmem_esdk.a without COPRTHR-2 SDK!)
SUBDIRS = src
endif

.PHONY: all $(SUBDIRS) check run clean distclean

all: $(SUBDIRS)

src:
ifndef COPRCC
$(MAKE) -C src -f Makefile.esdk
else
$(MAKE) -C src
endif

# dependencies on libshmem
example: src
test: src

check: src
$(MAKE) -C test check;

run: all
for d in $(SUBDIRS); do \
$(MAKE) -C $$d run; \
done

clean:
for d in $(SUBDIRS); do \
$(MAKE) -C $$d clean; \
done

distclean:
for d in $(SUBDIRS); do \
$(MAKE) -C $$d distclean; \
done
14 changes: 13 additions & 1 deletion example/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
SUBDIRS := $(wildcard */.)
SUBDIRS_ = $(wildcard */.)
SUBDIRS = $(SUBDIRS_:/.=)

.PHONY: all $(SUBDIRS) clean distclean

Expand All @@ -7,6 +8,17 @@ all: $(SUBDIRS)
$(SUBDIRS):
$(MAKE) -C $@

run: $(SUBDIRS)
@$(foreach x,$(SUBDIRS), \
printf '\n======================= ' && \
printf '%0.30s' '$x =========================' && \
printf '==========================\n' && \
cd $x && \
$(MAKE) -s run 2> /dev/null && \
cd .. && \
) printf '\n'


clean:
for d in $(SUBDIRS); do \
$(MAKE) -C $$d clean; \
Expand Down
6 changes: 6 additions & 0 deletions example/c_conjugate_gradient/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ TARGETS = main.x $(KERNEL)

all: $(TARGETS)

run: main.x
./$<

.PHONY: clean distclean

.SUFFIXES:
Expand All @@ -26,6 +29,9 @@ all: $(TARGETS)
main.x: main.c
$(CC) $(CFLAGS) $(INCS) main.c -o main.x $(LIBS)

foo.x: foo.c
$(CC) $(CFLAGS) $(INCS) foo.c -o foo.x $(LIBS)

shmem_tfunc.e32: shmem_tfunc.c dotprod.o
coprcc $(INCS) $(EDEFS) $(ELIBS) shmem_tfunc.c dotprod.o -o shmem_tfunc.e32

Expand Down
5 changes: 4 additions & 1 deletion example/c_diag_spmv/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ SHMEM = ../../src
INCS = -I. -I$(COPRTHR)/include -I$(SHMEM) -I../../common
LIBS = -L$(COPRTHR)/lib -lcoprthr -lcoprthrcc -lm

ELIBS = -L$(COPRTHR)/lib -lcoprthr_mpi -lcoprthr2_dev -L$(SHMEM) -lshmem_coprthr
ELIBS = -L$(COPRTHR)/lib -lcoprthr2_dev -L$(SHMEM) -lshmem_coprthr

TARGET = main.x shmem_tfunc.e32

all: $(TARGET)

run: main.x
./$<

.PHONY: clean install uninstall $(SUBDIRS)

.SUFFIXES:
Expand Down
5 changes: 5 additions & 0 deletions example/c_dynamic_calls/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ TARGETS = $(SRC_FILES:.c=.x)

all: $(TARGETS)

run: all
@$(foreach x,$(TARGETS), \
./run.sh \
)

info: all $(OBJ_FILES)

.PHONY: clean install uninstall
Expand Down
3 changes: 3 additions & 0 deletions example/c_gups/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ TARGETS = main.x $(KERNEL)

all: $(TARGETS)

run: main.x
./$<

.PHONY: clean distclean

.SUFFIXES:
Expand Down
3 changes: 3 additions & 0 deletions example/c_nbody/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ TARGET = main.x shmem_tfunc.e32 shmem_tfunc2.e32

all: $(TARGET)

run: main.x
./$<

.PHONY: clean install uninstall $(SUBDIRS)

.SUFFIXES:
Expand Down
3 changes: 3 additions & 0 deletions example/e_hello/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ OBJS = main.x e_task.elf

all: $(OBJS)

run: main.x
./$<

# Build HOST side application
.c.x:
gcc -O3 $< -o $@ $(EINCS) $(ELIBS) -lpthread
Expand Down
2 changes: 2 additions & 0 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ OBJS = $(SRC_FILES:.c=.o) $(ASM_FILES:.S=.o)

all: $(TARGETS)

run:

.PHONY: clean install uninstall

.SUFFIXES:
Expand Down
2 changes: 1 addition & 1 deletion test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ report.pdf: figures version.dat git.dat pes.dat report.tex
run: $(TARGETS)
@$(foreach x,$(TARGETS),coprsh -np $(CORES) ./$(x) 2> /dev/null &&) echo "Complete"

test: $(TARGETS)
check: $(TARGETS)
@$(foreach x,$(TARGETS), \
$(foreach n,$(NP), \
printf "%-3d%-27.27s " $(n) "$(x) .........................." && coprsh -np $(n) ./$(x) 2> /dev/null | \
Expand Down

0 comments on commit 21ce87d

Please sign in to comment.