diff options
| author | Joshua Bakita <jbakita@cs.unc.edu> | 2020-10-19 01:09:53 -0400 |
|---|---|---|
| committer | Joshua Bakita <jbakita@cs.unc.edu> | 2020-10-19 01:09:53 -0400 |
| commit | a71fc97fd262e1b5770f827047ea60bbaf38d9a2 (patch) | |
| tree | b45ef48c63a35817f2db93dd2fec718778f58b99 /all_pairs | |
| parent | 41358857592f1908d0c0f9898b6c9acabc1ad161 (diff) | |
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.
Diffstat (limited to 'all_pairs')
27 files changed, 69 insertions, 270 deletions
diff --git a/all_pairs/Makefile b/all_pairs/Makefile index 36cf55a..0042372 100644 --- a/all_pairs/Makefile +++ b/all_pairs/Makefile | |||
| @@ -1,57 +1,73 @@ | |||
| 1 | CC = gcc | 1 | LIBLITMUS ?= /media/speedy/litmus/liblitmus |
| 2 | CFLAGS = -pthread -O2 | 2 | CC ?= gcc |
| 3 | CFLAGS = -pthread -O2 -I.. -DPAIRED | ||
| 3 | LDFLAGS = -lrt | 4 | LDFLAGS = -lrt |
| 4 | all: bin/cjpeg_wrbmp bin/huff_enc bin/gsm_enc bin/dijkstra bin/h264_dec bin/susan bin/adpcm_enc bin/rijndael_dec bin/huff_dec bin/rijndael_enc bin/gsm_dec bin/anagram bin/epic bin/ammunition bin/g723_enc bin/ndes bin/petrinet bin/statemate bin/cjpeg_transupp bin/mpeg2 bin/fmref bin/audiobeam bin/adpcm_dec bin/cleanupSemaphores | 5 | COMMON = ../extra.h |
| 6 | |||
| 7 | # Handle cases where we're also profiling with the MMDC on the i.MX6Q | ||
| 8 | ifneq ($(shell grep "define MMDC 1" ../extra.h),) | ||
| 9 | COMMON += /media/speedy/litmus/tools/mmdc/mmdc.c | ||
| 10 | endif | ||
| 11 | |||
| 12 | # Include all the LITMUS^RT headers if we're using it | ||
| 13 | ifneq ($(shell grep "define LITMUS 1" ../extra.h),) | ||
| 14 | CFLAGS += -I${LIBLITMUS}/include -I${LIBLITMUS}/arch/arm/include | ||
| 15 | LDFLAGS += -L${LIBLITMUS} -llitmus | ||
| 16 | endif | ||
| 17 | |||
| 18 | all: bin/cjpeg_wrbmp bin/huff_enc bin/gsm_enc bin/dijkstra bin/h264_dec bin/susan bin/adpcm_enc bin/rijndael_dec bin/huff_dec bin/rijndael_enc bin/gsm_dec bin/anagram bin/epic bin/ammunition bin/g723_enc bin/ndes bin/petrinet bin/statemate bin/cjpeg_transupp bin/mpeg2 bin/fmref bin/audiobeam bin/adpcm_dec | ||
| 19 | |||
| 20 | debug: all | ||
| 21 | debug: CFLAGS += -ggdb3 | ||
| 5 | 22 | ||
| 6 | .PHONY: clean | 23 | .PHONY: clean |
| 7 | clean: | 24 | clean: |
| 8 | rm bin/cjpeg_wrbmp bin/huff_enc bin/gsm_enc bin/dijkstra bin/h264_dec bin/susan bin/adpcm_enc bin/rijndael_dec bin/huff_dec bin/rijndael_enc bin/gsm_dec bin/anagram bin/epic bin/ammunition bin/g723_enc bin/ndes bin/petrinet bin/statemate bin/cjpeg_transupp bin/mpeg2 bin/fmref bin/audiobeam bin/adpcm_dec bin/cleanupSemaphores | 25 | rm -f bin/cjpeg_wrbmp bin/huff_enc bin/gsm_enc bin/dijkstra bin/h264_dec bin/susan bin/adpcm_enc bin/rijndael_dec bin/huff_dec bin/rijndael_enc bin/gsm_dec bin/anagram bin/epic bin/ammunition bin/g723_enc bin/ndes bin/petrinet bin/statemate bin/cjpeg_transupp bin/mpeg2 bin/fmref bin/audiobeam bin/adpcm_dec |
| 9 | 26 | ||
| 10 | bin/cleanupSemaphores: ./source/extra.h ./source/cleanupSemaphores.c | 27 | bin/cjpeg_wrbmp: ${COMMON} ./source/cjpeg_wrbmp/cjpeg_wrbmp.c ./source/cjpeg_wrbmp/input.c |
| 11 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | ||
| 12 | bin/cjpeg_wrbmp: ./source/extra.h ./source/cjpeg_wrbmp/cjpeg_wrbmp.c ./source/cjpeg_wrbmp/input.c | ||
| 13 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 28 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
| 14 | bin/huff_enc: ./source/extra.h ./source/huff_enc/huff_enc.c | 29 | bin/huff_enc: ${COMMON} ./source/huff_enc/huff_enc.c |
| 15 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 30 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
| 16 | bin/gsm_enc: ./source/extra.h ./source/gsm_enc/gsm_enc.c | 31 | bin/gsm_enc: ${COMMON} ./source/gsm_enc/gsm_enc.c |
| 17 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 32 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
| 18 | bin/dijkstra: ./source/extra.h ./source/dijkstra/dijkstra.c ./source/dijkstra/input.c | 33 | bin/dijkstra: ${COMMON} ./source/dijkstra/dijkstra.c ./source/dijkstra/input.c |
| 19 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 34 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
| 20 | bin/h264_dec: ./source/extra.h ./source/h264_dec/h264_dec.c ./source/h264_dec/h264_decinput.c | 35 | bin/h264_dec: ${COMMON} ./source/h264_dec/h264_dec.c ./source/h264_dec/h264_decinput.c |
| 21 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 36 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
| 22 | bin/susan: ./source/extra.h ./source/susan/input.c ./source/susan/susan.c ./source/susan/wccfile.c ./source/susan/wcclibm.c ./source/susan/wccmalloc.c | 37 | bin/susan: ${COMMON} ./source/susan/input.c ./source/susan/susan.c ./source/susan/wccfile.c ./source/susan/wcclibm.c ./source/susan/wccmalloc.c |
| 23 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 38 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
| 24 | bin/adpcm_enc: ./source/extra.h ./source/adpcm_enc/adpcm_enc.c | 39 | bin/adpcm_enc: ${COMMON} ./source/adpcm_enc/adpcm_enc.c |
| 25 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 40 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
| 26 | bin/rijndael_dec: ./source/extra.h ./source/rijndael_dec/aes.c ./source/rijndael_dec/input_small_enc.c ./source/rijndael_dec/rijndael_dec.c ./source/rijndael_dec/rijndael_dec_libc.c | 41 | bin/rijndael_dec: ${COMMON} ./source/rijndael_dec/aes.c ./source/rijndael_dec/input_small_enc.c ./source/rijndael_dec/rijndael_dec.c ./source/rijndael_dec/rijndael_dec_libc.c |
| 27 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 42 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
| 28 | bin/huff_dec: ./source/extra.h ./source/huff_dec/huff_dec.c | 43 | bin/huff_dec: ${COMMON} ./source/huff_dec/huff_dec.c |
| 29 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 44 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
| 30 | bin/rijndael_enc: ./source/extra.h ./source/rijndael_enc/aes.c ./source/rijndael_enc/input_small.c ./source/rijndael_enc/rijndael_enc.c ./source/rijndael_enc/rijndael_enc_libc.c | 45 | bin/rijndael_enc: ${COMMON} ./source/rijndael_enc/aes.c ./source/rijndael_enc/input_small.c ./source/rijndael_enc/rijndael_enc.c ./source/rijndael_enc/rijndael_enc_libc.c |
| 31 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 46 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
| 32 | bin/gsm_dec: ./source/extra.h ./source/gsm_dec/gsm_dec.c | 47 | bin/gsm_dec: ${COMMON} ./source/gsm_dec/gsm_dec.c |
| 33 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 48 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
| 34 | bin/anagram: ./source/extra.h ./source/anagram/anagram.c ./source/anagram/anagram_input.c ./source/anagram/anagram_stdlib.c | 49 | bin/anagram: ${COMMON} ./source/anagram/anagram.c ./source/anagram/anagram_input.c ./source/anagram/anagram_stdlib.c |
| 35 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 50 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
| 36 | bin/epic: ./source/extra.h ./source/epic/epic.c | 51 | bin/epic: ${COMMON} ./source/epic/epic.c |
| 37 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 52 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
| 38 | bin/ammunition: ./source/extra.h ./source/ammunition/ammunition.c ./source/ammunition/ammunition_libc.c ./source/ammunition/arithm.c ./source/ammunition/bits.c | 53 | bin/ammunition: ${COMMON} ./source/ammunition/ammunition.c ./source/ammunition/ammunition_libc.c ./source/ammunition/arithm.c ./source/ammunition/bits.c |
| 39 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 54 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
| 40 | bin/g723_enc: ./source/extra.h ./source/g723_enc/g723_enc.c | 55 | bin/g723_enc: ${COMMON} ./source/g723_enc/g723_enc.c |
| 41 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 56 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
| 42 | bin/ndes: ./source/extra.h ./source/ndes/ndes.c | 57 | bin/ndes: ${COMMON} ./source/ndes/ndes.c |
| 43 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 58 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
| 44 | bin/petrinet: ./source/extra.h ./source/petrinet/petrinet.c | 59 | bin/petrinet: ${COMMON} ./source/petrinet/petrinet.c |
| 45 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 60 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
| 46 | bin/statemate: ./source/extra.h ./source/statemate/statemate.c | 61 | bin/statemate: ${COMMON} ./source/statemate/statemate.c |
| 47 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 62 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
| 48 | bin/cjpeg_transupp: ./source/extra.h ./source/cjpeg_transupp/cjpeg_transupp.c | 63 | bin/cjpeg_transupp: ${COMMON} ./source/cjpeg_transupp/cjpeg_transupp.c |
| 49 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 64 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
| 50 | bin/mpeg2: ./source/extra.h ./source/mpeg2/mpeg2.c | 65 | bin/mpeg2: ${COMMON} ./source/mpeg2/mpeg2.c |
| 51 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 66 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
| 52 | bin/fmref: ./source/extra.h ./source/fmref/fmref.c ./source/fmref/wcclibm.c | 67 | bin/fmref: ${COMMON} ./source/fmref/fmref.c ./source/fmref/wcclibm.c |
| 53 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 68 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
| 54 | bin/audiobeam: ./source/extra.h ./source/audiobeam/audiobeam.c ./source/audiobeam/audiobeaminput.c ./source/audiobeam/audiobeamlibmalloc.c ./source/audiobeam/audiobeamlibm.c | 69 | bin/audiobeam: ${COMMON} ./source/audiobeam/audiobeam.c ./source/audiobeam/audiobeaminput.c ./source/audiobeam/audiobeamlibmalloc.c ./source/audiobeam/audiobeamlibm.c |
| 55 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 70 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
| 56 | bin/adpcm_dec: ./source/extra.h ./source/adpcm_dec/adpcm_dec.c | 71 | bin/adpcm_dec: ${COMMON} ./source/adpcm_dec/adpcm_dec.c |
| 57 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 72 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
| 73 | |||
diff --git a/all_pairs/source/adpcm_dec/adpcm_dec.c b/all_pairs/source/adpcm_dec/adpcm_dec.c index 04a5746..368e98d 100644 --- a/all_pairs/source/adpcm_dec/adpcm_dec.c +++ b/all_pairs/source/adpcm_dec/adpcm_dec.c | |||
| @@ -35,7 +35,7 @@ | |||
| 35 | Forward declaration of functions | 35 | Forward declaration of functions |
| 36 | */ | 36 | */ |
| 37 | 37 | ||
| 38 | #include "../extra.h" | 38 | #include "extra.h" |
| 39 | 39 | ||
| 40 | void adpcm_dec_decode( int ); | 40 | void adpcm_dec_decode( int ); |
| 41 | int adpcm_dec_filtez( int *bpl, int *dlt ); | 41 | int adpcm_dec_filtez( int *bpl, int *dlt ); |
diff --git a/all_pairs/source/adpcm_enc/adpcm_enc.c b/all_pairs/source/adpcm_enc/adpcm_enc.c index 464768f..777aaf5 100644 --- a/all_pairs/source/adpcm_enc/adpcm_enc.c +++ b/all_pairs/source/adpcm_enc/adpcm_enc.c | |||
| @@ -29,7 +29,7 @@ | |||
| 29 | 29 | ||
| 30 | /* common sampling rate for sound cards on IBM/PC */ | 30 | /* common sampling rate for sound cards on IBM/PC */ |
| 31 | 31 | ||
| 32 | #include "../extra.h" | 32 | #include "extra.h" |
| 33 | #define SAMPLE_RATE 11025 | 33 | #define SAMPLE_RATE 11025 |
| 34 | 34 | ||
| 35 | #define PI 3141 | 35 | #define PI 3141 |
diff --git a/all_pairs/source/ammunition/ammunition.c b/all_pairs/source/ammunition/ammunition.c index 269f4c0..052520e 100644 --- a/all_pairs/source/ammunition/ammunition.c +++ b/all_pairs/source/ammunition/ammunition.c | |||
| @@ -24,7 +24,7 @@ | |||
| 24 | 24 | ||
| 25 | */ | 25 | */ |
| 26 | 26 | ||
