From a71fc97fd262e1b5770f827047ea60bbaf38d9a2 Mon Sep 17 00:00:00 2001 From: Joshua Bakita Date: Mon, 19 Oct 2020 01:09:53 -0400 Subject: Unify all the versions of extra.h into a single multipurpose header There was previously a huge amount of shared code that had to be copied back and forth. This should reduce the maintenance burden by containing all future changes to a single file. New unified library is fully backwards-compatible but also introduces and the easy-to-use `for_each_job` macro which replaces the specific `for(...) START_LOOP ... STOP_LOOP` format requirement and is generally much harder to abuse. New unified library also automatically cleans up its shared memory and semaphores, so this commit also removes the separate `cleanupSemaphores` binary. I also found a precursor of `extra.h` written by Sims in `litmusStuff.h`. This code is only interesting for historical purposes, so it is also removed in this commit. This commit also adds debug options to all the Makefiles and silences rm's complaints about non-existent files in make clean. --- dis/Makefile | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) (limited to 'dis/Makefile') diff --git a/dis/Makefile b/dis/Makefile index 2c1ff89..df93116 100755 --- a/dis/Makefile +++ b/dis/Makefile @@ -4,34 +4,33 @@ # that a good Makefile should follow. Sorry - at least I have one.) LIBLITMUS ?= /media/speedy/litmus/liblitmus CC ?= gcc -override CFLAGS += -pthread -O2 +CFLAGS += -pthread -O2 -I.. LDFLAGS = -lrt -lm - -# We need a different include path depending on the target, so use a -# target-specific variable -field matrix neighborhood pointer transitive update random_walk: override CFLAGS += -I../baseline/source -field matrix neighborhood pointer transitive update random_walk: COMMON = ../baseline/source/extra.h -field_all matrix_all neighborhood_all pointer_all transitive_all update_all: override CFLAGS += -I../all_pairs/source -field_all matrix_all neighborhood_all pointer_all transitive_all update_all: COMMON = ../all_pairs/source/extra.h +COMMON = ../extra.h # Handle cases where we're also profiling with the MMDC on the i.MX6Q -ifneq ($(shell grep "define MMDC 1" ../baseline/source/extra.h),) +ifneq ($(shell grep "define MMDC 1" ../extra.h),) COMMON += /media/speedy/litmus/tools/mmdc/mmdc.c endif # Include all the LITMUS^RT headers if we're using it -ifneq ($(shell grep "define LITMUS 1" ../baseline/source/extra.h),) +ifneq ($(shell grep "define LITMUS 1" ../extra.h),) CFLAGS += -I${LIBLITMUS}/include -I${LIBLITMUS}/arch/arm/include LDFLAGS += -L${LIBLITMUS} -llitmus endif all: baseline +debug: baseline +debug_pairs: pairs +debug debug_pairs: CFLAGS += -ggdb3 baseline: field matrix neighborhood pointer transitive update random_walk pairs: field_all matrix_all neighborhood_all pointer_all transitive_all update_all .PHONY: clean clean: - rm field_all matrix_all neighborhood_all pointer_all transitive_all update_all field matrix neighborhood pointer transitive update random_walk + rm -f field_all matrix_all neighborhood_all pointer_all \ + transitive_all update_all field matrix neighborhood \ + pointer transitive update random_walk field: ${COMMON} ./Field/field.c $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) @@ -49,14 +48,14 @@ random_walk: ${COMMON} random_walk.c $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) field_all: ${COMMON} ./Field/field.c - $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) + $(CC) $(CFLAGS) -DPAIRED $^ -o $@ $(LDFLAGS) matrix_all: ${COMMON} ./Matrix/ver2/matrix.c - $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) + $(CC) $(CFLAGS) -DPAIRED $^ -o $@ $(LDFLAGS) neighborhood_all: ${COMMON} ./Neighborhood/neighborhood.c - $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) + $(CC) $(CFLAGS) -DPAIRED $^ -o $@ $(LDFLAGS) pointer_all: ${COMMON} ./Pointer/pointer.c - $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) + $(CC) $(CFLAGS) -DPAIRED $^ -o $@ $(LDFLAGS) transitive_all: ${COMMON} ./Transitive/transitive.c - $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) + $(CC) $(CFLAGS) -DPAIRED $^ -o $@ $(LDFLAGS) update_all: ${COMMON} ./Update/update.c - $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) + $(CC) $(CFLAGS) -DPAIRED $^ -o $@ $(LDFLAGS) -- cgit v1.2.2