From 49a2820000a4462c3c922a901751181d0e567937 Mon Sep 17 00:00:00 2001 From: sbahra Date: Tue, 17 May 2011 12:51:04 -0700 Subject: [PATCH] Added support for Sun Studio 12 C compiler. build: - configure step will generate relevant CFLAGS. - build profiles are for convenience (developers can use themu for cross-compilation). regressions: - Renamed ck_barrier unit tests to work-around behavior of Solaris linker. - Adopted use of a PTHREAD_CFLAGS variable. ck_cc: - Added internal CK_CC_IMM macro for compilers that are verbose against impossible inline constraints (or limited optimizers). ck_pr/x86*: - Adopted CK_CC_IMM macro. - Dropped redundant constraints. This work was mostly completed by Theo Schlossnagle , much thanks to him. He has also provided access to a machine with Sun Studio 12. --- .gitignore | 10 +-- Makefile.in | 8 +-- build/ck.build.in | 4 +- build/regressions.build.in | 5 +- configure | 34 +++++++++- include/ck_cc.h | 2 +- include/gcc/ck_cc.h | 12 ++-- include/gcc/x86/ck_pr.h | 8 +-- include/gcc/x86_64/ck_pr.h | 10 +-- regressions/Makefile | 68 +++++++++---------- regressions/ck_barrier/benchmark/Makefile | 3 +- regressions/ck_barrier/validate/Makefile | 24 +++---- ...er_centralized.c => barrier_centralized.c} | 0 ...arrier_combining.c => barrier_combining.c} | 0 ...issemination.c => barrier_dissemination.c} | 0 .../{ck_barrier_mcs.c => barrier_mcs.c} | 0 ...rier_tournament.c => barrier_tournament.c} | 0 regressions/ck_bytelock/benchmark/Makefile | 4 +- regressions/ck_bytelock/validate/Makefile | 4 +- regressions/ck_epoch/validate/Makefile | 2 +- regressions/ck_fifo/benchmark/Makefile | 2 +- regressions/ck_fifo/validate/Makefile | 2 +- regressions/ck_hp/benchmark/Makefile | 2 +- regressions/ck_hp/validate/Makefile | 2 +- regressions/ck_pr/benchmark/Makefile | 2 +- regressions/ck_pr/validate/Makefile | 1 - regressions/ck_ring/validate/Makefile | 2 +- regressions/ck_sequence/validate/Makefile | 2 +- regressions/ck_spinlock/benchmark/Makefile | 2 +- regressions/ck_spinlock/validate/Makefile | 2 +- regressions/ck_stack/benchmark/Makefile | 2 +- regressions/ck_stack/validate/Makefile | 18 ++--- src/Makefile | 2 +- 33 files changed, 138 insertions(+), 101 deletions(-) rename regressions/ck_barrier/validate/{ck_barrier_centralized.c => barrier_centralized.c} (100%) rename regressions/ck_barrier/validate/{ck_barrier_combining.c => barrier_combining.c} (100%) rename regressions/ck_barrier/validate/{ck_barrier_dissemination.c => barrier_dissemination.c} (100%) rename regressions/ck_barrier/validate/{ck_barrier_mcs.c => barrier_mcs.c} (100%) rename regressions/ck_barrier/validate/{ck_barrier_tournament.c => barrier_tournament.c} (100%) diff --git a/.gitignore b/.gitignore index bbd308b..9922f03 100644 --- a/.gitignore +++ b/.gitignore @@ -7,11 +7,11 @@ build/regressions.build *.so *.dSYM regressions/ck_barrier/benchmark/throughput -regressions/ck_barrier/validate/ck_barrier_centralized -regressions/ck_barrier/validate/ck_barrier_combining -regressions/ck_barrier/validate/ck_barrier_dissemination -regressions/ck_barrier/validate/ck_barrier_mcs -regressions/ck_barrier/validate/ck_barrier_tournament +regressions/ck_barrier/validate/barrier_centralized +regressions/ck_barrier/validate/barrier_combining +regressions/ck_barrier/validate/barrier_dissemination +regressions/ck_barrier/validate/barrier_mcs +regressions/ck_barrier/validate/barrier_tournament regressions/ck_bytelock/benchmark/latency regressions/ck_bytelock/validate/validate regressions/ck_epoch/validate/ck_stack diff --git a/Makefile.in b/Makefile.in index b93413a..73b9d74 100644 --- a/Makefile.in +++ b/Makefile.in @@ -7,13 +7,13 @@ HEADERS=@HEADERS@ PKGCONFIG_DATA=@LIBRARY@/pkgconfig all: - make -C src all || exit + $(MAKE) -C src all || exit @echo @echo @echo ---[ Concurrency Kit has built successfully. You may now \"make install\". regressions: - make -C regressions all || exit + $(MAKE) -C regressions all || exit @echo ---[ Regressions have built successfully. install: all @@ -39,8 +39,8 @@ uninstall: rm -f $(PKGCONFIG_DATA)/ck.pc clean: - make -C src clean - make -C regressions clean + $(MAKE) -C src clean + $(MAKE) -C regressions clean rm -f *~ *.o distribution: clean diff --git a/build/ck.build.in b/build/ck.build.in index d43edd5..03a6e72 100644 --- a/build/ck.build.in +++ b/build/ck.build.in @@ -1,5 +1,7 @@ CC=@CC@ MAKE=make -CFLAGS=-D_XOPEN_SOURCE=600 -D_BSD_SOURCE -I../include -std=gnu99 -pedantic -Wall -W -Wundef -Wendif-labels -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wdisabled-optimization -fstrict-aliasing -O2 -pipe -Wno-parentheses @CFLAGS@ +CFLAGS=@CFLAGS@ -I../include +LDFLAGS=@LDFLAGS@ +LD=@LD@ include ../build/ck.build.@PROFILE@ diff --git a/build/regressions.build.in b/build/regressions.build.in index 9020251..bd845ea 100644 --- a/build/regressions.build.in +++ b/build/regressions.build.in @@ -1,5 +1,8 @@ CC=@CC@ MAKE=make -CFLAGS=-D_XOPEN_SOURCE=600 -D_BSD_SOURCE -I../../../include -std=gnu99 -pedantic -Wall -W -Wundef -Wendif-labels -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wdisabled-optimization -fstrict-aliasing -O2 -pipe -Wno-parentheses @CFLAGS@ +CFLAGS=@CFLAGS@ -I../../../include +LD=@LD@ +LDFLAGS=@LDFLAGS@ +PTHREADS_LDFLAGS=@PTHREADS_CFLAGS@ include ../../../build/ck.build.@PROFILE@ diff --git a/configure b/configure index f9cb468..8335586 100755 --- a/configure +++ b/configure @@ -82,6 +82,9 @@ generate() -e "s#@HEADERS@#$HEADERS#g" \ -e "s#@LIBRARY@#$LIBRARY#g" \ -e "s#@PREFIX@#$PREFIX#g" \ + -e "s#@LD@#$LD#g" \ + -e "s#@LDFLAGS@#$LDFLAGS#g" \ + -e "s#@PTHREAD_CFLAGS@#$PTHREAD_CFLAGS#g" \ $1 > $2 } @@ -91,7 +94,11 @@ generate_stdout() echo echo " PROFILE = $PROFILE" echo " CC = $CC" - echo " Additional CFLAGS = $CFLAGS" + echo " COMPILER = $COMPILER" + echo " CFLAGS = $CFLAGS" + echo " PTHREAD_CFLAGS = $PTHREAD_CFLAGS" + echo " LD = $LD" + echo " LDFLAGS = $LDFLAGS" echo echo "Headers will be installed in $HEADERS" echo "Libraries will be installed in $LIBRARY" @@ -285,6 +292,7 @@ assert "$PLATFORM" "$PLATFORM" "unsupported" # Platform will be used as a macro. PROFILE="${PROFILE:-$PLATFORM}" PLATFORM="__${PLATFORM}__" +LDFLAGS="-shared -fPIC" printf "Finding suitable compiler........" @@ -312,8 +320,13 @@ assert "$CC" "not found" # Make sure GCC 4.X, the only supported compiler, is being used. cat << EOF > .1.c +#include int main(void) { #if defined(__GNUC__) && (__GNUC__ >= 4) + puts("gcc"); + return (0); +#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5110) + puts("suncc"); return (0); #else return (1); @@ -322,7 +335,7 @@ int main(void) { EOF $CC -o .1 .1.c -./.1 +COMPILER=`./.1` r=$? rm -f .1.c .1 @@ -332,6 +345,23 @@ else echo "success [$CC]" fi +if test "$COMPILER" = "suncc"; then + LD=/bin/ld + LDFLAGS="-G" + CFLAGS="-xO5" + PTHREAD_CFLAGS="-mt -lpthread" +elif test "$COMPILER" = "gcc"; then + LD=$CC + LDFLAGS="-shared -fPIC" + CFLAGS="-D_XOPEN_SOURCE=600 -D_BSD_SOURCE -std=gnu99 -pedantic -Wall -W -Wundef" \ + "-Wendif-labels -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align" \ + "-Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs" \ + "-Winline -Wdisabled-optimization -fstrict-aliasing -O2 -pipe -Wno-parentheses" + PTHREAD_CFLAGS="-pthread" +else + assert "" "unknown compiler" +fi + for i in $REQUIRE_HEADER; do printf "Checking header file usability..." diff --git a/include/ck_cc.h b/include/ck_cc.h index d6c1693..fdb6096 100644 --- a/include/ck_cc.h +++ b/include/ck_cc.h @@ -27,7 +27,7 @@ #ifndef _CK_CC_H #define _CK_CC_H -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__SUNPRO_C) #include "gcc/ck_cc.h" #endif diff --git a/include/gcc/ck_cc.h b/include/gcc/ck_cc.h index 6d8dbcd..6d06534 100644 --- a/include/gcc/ck_cc.h +++ b/include/gcc/ck_cc.h @@ -1,5 +1,5 @@ /* - * Copyright 2009, 2010 Samy Al Bahra. + * Copyright 2009-2011 Samy Al Bahra. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,11 +29,15 @@ #include -/* - * Suppress unused warnings. - */ +#ifdef __SUNPRO_C +#define CK_CC_UNUSED +#define CK_CC_USED +#define CK_CC_IMM +#else #define CK_CC_UNUSED __attribute__((unused)) #define CK_CC_USED __attribute__((used)) +#define CK_CC_IMM "i" +#endif /* * If optimizations are turned on, then force inlining. diff --git a/include/gcc/x86/ck_pr.h b/include/gcc/x86/ck_pr.h index 3cbc18c..6f676b8 100644 --- a/include/gcc/x86/ck_pr.h +++ b/include/gcc/x86/ck_pr.h @@ -96,9 +96,9 @@ CK_PR_FENCE(memory, "mfence") ck_pr_fas_##S(M *target, T v) \ { \ __asm__ __volatile__(I " %0, %1" \ - : "=m" (*(C *)target), \ + : "+m" (*(C *)target), \ "+q" (v) \ - : "m" (*(C *)target) \ + : \ : "memory"); \ return v; \ } @@ -149,7 +149,7 @@ CK_PR_LOAD_S(8, uint8_t, "movb") { \ __asm__ __volatile__(I " %1, %0" \ : "=m" (*(C *)target) \ - : "iq" (v) \ + : CK_CC_IMM "q" (v) \ : "memory"); \ return; \ } @@ -263,7 +263,7 @@ CK_PR_GENERATE(not) { \ __asm__ __volatile__(CK_PR_LOCK_PREFIX I " %1, %0" \ : "+m" (*(C *)target) \ - : "iq" (d) \ + : CK_CC_IMM "q" (d) \ : "memory", "cc"); \ return; \ } diff --git a/include/gcc/x86_64/ck_pr.h b/include/gcc/x86_64/ck_pr.h index fdd3c62..fc0516e 100644 --- a/include/gcc/x86_64/ck_pr.h +++ b/include/gcc/x86_64/ck_pr.h @@ -1,5 +1,5 @@ /* - * Copyright 2009, 2010 Samy Al Bahra. + * Copyright 2009-2011 Samy Al Bahra. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -95,9 +95,9 @@ CK_PR_FENCE(memory, "mfence") ck_pr_fas_##S(M *target, T v) \ { \ __asm__ __volatile__(I " %0, %1" \ - : "=m" (*(C *)target), \ + : "+m" (*(C *)target), \ "+q" (v) \ - : "m" (*(C *)target) \ + : \ : "memory"); \ return v; \ } @@ -194,7 +194,7 @@ CK_PR_LOAD_2(8, 16, uint8_t) { \ __asm__ __volatile__(I " %1, %0" \ : "=m" (*(C *)target) \ - : "iq" (v) \ + : CK_CC_IMM "q" (v) \ : "memory"); \ return; \ } @@ -311,7 +311,7 @@ CK_PR_GENERATE(not) { \ __asm__ __volatile__(CK_PR_LOCK_PREFIX I " %1, %0" \ : "+m" (*(C *)target) \ - : "iq" (d) \ + : CK_CC_IMM "q" (d) \ : "memory", "cc"); \ return; \ } diff --git a/regressions/Makefile b/regressions/Makefile index 2c55ad9..2b3eca0 100644 --- a/regressions/Makefile +++ b/regressions/Makefile @@ -1,40 +1,40 @@ .PHONY: all clean all: - make -C ./ck_spinlock/validate all - make -C ./ck_spinlock/benchmark all - make -C ./ck_fifo/validate all - make -C ./ck_fifo/benchmark all - make -C ./ck_pr/validate all - make -C ./ck_pr/benchmark all - make -C ./ck_barrier/validate all - make -C ./ck_barrier/benchmark all - make -C ./ck_bytelock/validate all - make -C ./ck_bytelock/benchmark all - make -C ./ck_epoch/validate all - make -C ./ck_sequence/validate all - make -C ./ck_stack/validate all - make -C ./ck_stack/benchmark all - make -C ./ck_ring/validate all - make -C ./ck_hp/validate all - make -C ./ck_hp/benchmark all + $(MAKE) -C ./ck_spinlock/validate all + $(MAKE) -C ./ck_spinlock/benchmark all + $(MAKE) -C ./ck_fifo/validate all + $(MAKE) -C ./ck_fifo/benchmark all + $(MAKE) -C ./ck_pr/validate all + $(MAKE) -C ./ck_pr/benchmark all + $(MAKE) -C ./ck_barrier/validate all + $(MAKE) -C ./ck_barrier/benchmark all + $(MAKE) -C ./ck_bytelock/validate all + $(MAKE) -C ./ck_bytelock/benchmark all + $(MAKE) -C ./ck_epoch/validate all + $(MAKE) -C ./ck_sequence/validate all + $(MAKE) -C ./ck_stack/validate all + $(MAKE) -C ./ck_stack/benchmark all + $(MAKE) -C ./ck_ring/validate all + $(MAKE) -C ./ck_hp/validate all + $(MAKE) -C ./ck_hp/benchmark all clean: - make -C ./ck_spinlock/validate clean - make -C ./ck_spinlock/benchmark clean - make -C ./ck_fifo/validate clean - make -C ./ck_fifo/benchmark clean - make -C ./ck_pr/validate clean - make -C ./ck_pr/benchmark clean - make -C ./ck_barrier/validate clean - make -C ./ck_barrier/benchmark clean - make -C ./ck_bytelock/validate clean - make -C ./ck_bytelock/benchmark clean - make -C ./ck_epoch/validate clean - make -C ./ck_sequence/validate clean - make -C ./ck_stack/validate clean - make -C ./ck_stack/benchmark clean - make -C ./ck_ring/validate clean - make -C ./ck_hp/validate clean - make -C ./ck_hp/benchmark clean + $(MAKE) -C ./ck_spinlock/validate clean + $(MAKE) -C ./ck_spinlock/benchmark clean + $(MAKE) -C ./ck_fifo/validate clean + $(MAKE) -C ./ck_fifo/benchmark clean + $(MAKE) -C ./ck_pr/validate clean + $(MAKE) -C ./ck_pr/benchmark clean + $(MAKE) -C ./ck_barrier/validate clean + $(MAKE) -C ./ck_barrier/benchmark clean + $(MAKE) -C ./ck_bytelock/validate clean + $(MAKE) -C ./ck_bytelock/benchmark clean + $(MAKE) -C ./ck_epoch/validate clean + $(MAKE) -C ./ck_sequence/validate clean + $(MAKE) -C ./ck_stack/validate clean + $(MAKE) -C ./ck_stack/benchmark clean + $(MAKE) -C ./ck_ring/validate clean + $(MAKE) -C ./ck_hp/validate clean + $(MAKE) -C ./ck_hp/benchmark clean diff --git a/regressions/ck_barrier/benchmark/Makefile b/regressions/ck_barrier/benchmark/Makefile index b74a0dd..864c6fc 100644 --- a/regressions/ck_barrier/benchmark/Makefile +++ b/regressions/ck_barrier/benchmark/Makefile @@ -11,5 +11,4 @@ clean: rm -rf *.dSYM *~ *.o $(OBJECTS) include ../../../build/regressions.build -CFLAGS+=-D_GNU_SOURCE -pthread - +CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE diff --git a/regressions/ck_barrier/validate/Makefile b/regressions/ck_barrier/validate/Makefile index 53181fe..3cd122c 100644 --- a/regressions/ck_barrier/validate/Makefile +++ b/regressions/ck_barrier/validate/Makefile @@ -1,26 +1,26 @@ .PHONY: clean distribution -OBJECTS=ck_barrier_centralized ck_barrier_combining ck_barrier_dissemination ck_barrier_tournament ck_barrier_mcs +OBJECTS=barrier_centralized barrier_combining barrier_dissemination barrier_tournament barrier_mcs all: $(OBJECTS) -ck_barrier_centralized: ck_barrier_centralized.c ../../../include/ck_barrier.h ../../../src/ck_barrier_centralized.c - $(CC) $(CFLAGS) -o ck_barrier_centralized ck_barrier_centralized.c ../../../src/ck_barrier_centralized.c +barrier_centralized: barrier_centralized.c ../../../include/ck_barrier.h ../../../src/ck_barrier_centralized.c + $(CC) $(CFLAGS) -o barrier_centralized barrier_centralized.c ../../../src/ck_barrier_centralized.c -ck_barrier_combining: ck_barrier_combining.c ../../../include/ck_barrier.h ../../../src/ck_barrier_combining.c - $(CC) $(CFLAGS) -o ck_barrier_combining ck_barrier_combining.c ../../../src/ck_barrier_combining.c +barrier_combining: barrier_combining.c ../../../include/ck_barrier.h ../../../src/ck_barrier_combining.c + $(CC) $(CFLAGS) -o barrier_combining barrier_combining.c ../../../src/ck_barrier_combining.c -ck_barrier_dissemination: ck_barrier_dissemination.c ../../../include/ck_barrier.h ../../../src/ck_barrier_dissemination.c - $(CC) $(CFLAGS) -o ck_barrier_dissemination ck_barrier_dissemination.c ../../../src/ck_barrier_dissemination.c +barrier_dissemination: barrier_dissemination.c ../../../include/ck_barrier.h ../../../src/ck_barrier_dissemination.c + $(CC) $(CFLAGS) -o barrier_dissemination barrier_dissemination.c ../../../src/ck_barrier_dissemination.c -ck_barrier_tournament: ck_barrier_tournament.c ../../../include/ck_barrier.h ../../../src/ck_barrier_tournament.c - $(CC) $(CFLAGS) -o ck_barrier_tournament ck_barrier_tournament.c ../../../src/ck_barrier_tournament.c +barrier_tournament: barrier_tournament.c ../../../include/ck_barrier.h ../../../src/ck_barrier_tournament.c + $(CC) $(CFLAGS) -o barrier_tournament barrier_tournament.c ../../../src/ck_barrier_tournament.c -ck_barrier_mcs: ck_barrier_mcs.c ../../../include/ck_barrier.h ../../../src/ck_barrier_mcs.c - $(CC) $(CFLAGS) -o ck_barrier_mcs ck_barrier_mcs.c ../../../src/ck_barrier_mcs.c +barrier_mcs: barrier_mcs.c ../../../include/ck_barrier.h ../../../src/ck_barrier_mcs.c + $(CC) $(CFLAGS) -o barrier_mcs barrier_mcs.c ../../../src/ck_barrier_mcs.c clean: rm -rf *.dSYM *~ *.o $(OBJECTS) include ../../../build/regressions.build -CFLAGS+=-D_GNU_SOURCE -pthread +CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE diff --git a/regressions/ck_barrier/validate/ck_barrier_centralized.c b/regressions/ck_barrier/validate/barrier_centralized.c similarity index 100% rename from regressions/ck_barrier/validate/ck_barrier_centralized.c rename to regressions/ck_barrier/validate/barrier_centralized.c diff --git a/regressions/ck_barrier/validate/ck_barrier_combining.c b/regressions/ck_barrier/validate/barrier_combining.c similarity index 100% rename from regressions/ck_barrier/validate/ck_barrier_combining.c rename to regressions/ck_barrier/validate/barrier_combining.c diff --git a/regressions/ck_barrier/validate/ck_barrier_dissemination.c b/regressions/ck_barrier/validate/barrier_dissemination.c similarity index 100% rename from regressions/ck_barrier/validate/ck_barrier_dissemination.c rename to regressions/ck_barrier/validate/barrier_dissemination.c diff --git a/regressions/ck_barrier/validate/ck_barrier_mcs.c b/regressions/ck_barrier/validate/barrier_mcs.c similarity index 100% rename from regressions/ck_barrier/validate/ck_barrier_mcs.c rename to regressions/ck_barrier/validate/barrier_mcs.c diff --git a/regressions/ck_barrier/validate/ck_barrier_tournament.c b/regressions/ck_barrier/validate/barrier_tournament.c similarity index 100% rename from regressions/ck_barrier/validate/ck_barrier_tournament.c rename to regressions/ck_barrier/validate/barrier_tournament.c diff --git a/regressions/ck_bytelock/benchmark/Makefile b/regressions/ck_bytelock/benchmark/Makefile index 967e271..0fe3712 100644 --- a/regressions/ck_bytelock/benchmark/Makefile +++ b/regressions/ck_bytelock/benchmark/Makefile @@ -5,10 +5,10 @@ OBJECTS=latency all: $(OBJECTS) latency: latency.c - $(CC) $(CFLAGS) -o latency latency.c -pthread + $(CC) $(CFLAGS) -o latency latency.c clean: rm -rf *.dSYM *~ *.o $(OBJECTS) include ../../../build/regressions.build -CFLAGS+=-ggdb -D_GNU_SOURCE +CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE diff --git a/regressions/ck_bytelock/validate/Makefile b/regressions/ck_bytelock/validate/Makefile index 02b795d..c125160 100644 --- a/regressions/ck_bytelock/validate/Makefile +++ b/regressions/ck_bytelock/validate/Makefile @@ -5,10 +5,10 @@ OBJECTS=validate all: $(OBJECTS) validate: validate.c - $(CC) $(CFLAGS) -o validate validate.c -pthread + $(CC) $(CFLAGS) -o validate validate.c clean: rm -rf *.dSYM *~ *.o $(OBJECTS) include ../../../build/regressions.build -CFLAGS+=-D_GNU_SOURCE +CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE diff --git a/regressions/ck_epoch/validate/Makefile b/regressions/ck_epoch/validate/Makefile index 2ed6010..7544ba4 100644 --- a/regressions/ck_epoch/validate/Makefile +++ b/regressions/ck_epoch/validate/Makefile @@ -14,4 +14,4 @@ clean: rm -rf *~ *.o $(OBJECTS) *.dSYM include ../../../build/regressions.build -CFLAGS+=-pthread -D_GNU_SOURCE +CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE diff --git a/regressions/ck_fifo/benchmark/Makefile b/regressions/ck_fifo/benchmark/Makefile index 61c3f6e..ddcdcd5 100644 --- a/regressions/ck_fifo/benchmark/Makefile +++ b/regressions/ck_fifo/benchmark/Makefile @@ -11,4 +11,4 @@ clean: rm -rf *~ *.o *.dSYM $(OBJECTS) include ../../../build/regressions.build -CFLAGS+=-pthread -D_GNU_SOURCE +CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE diff --git a/regressions/ck_fifo/validate/Makefile b/regressions/ck_fifo/validate/Makefile index 5b8bad8..cb53469 100644 --- a/regressions/ck_fifo/validate/Makefile +++ b/regressions/ck_fifo/validate/Makefile @@ -20,4 +20,4 @@ clean: rm -rf *.dSYM *~ *.o $(OBJECTS) include ../../../build/regressions.build -CFLAGS+=-pthread -D_GNU_SOURCE +CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE diff --git a/regressions/ck_hp/benchmark/Makefile b/regressions/ck_hp/benchmark/Makefile index b1edcd0..1e4236d 100644 --- a/regressions/ck_hp/benchmark/Makefile +++ b/regressions/ck_hp/benchmark/Makefile @@ -14,4 +14,4 @@ clean: rm -rf *~ *.o *.dSYM $(OBJECTS) include ../../../build/regressions.build -CFLAGS+=-pthread -D_GNU_SOURCE +CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE diff --git a/regressions/ck_hp/validate/Makefile b/regressions/ck_hp/validate/Makefile index b7f1789..80e872f 100644 --- a/regressions/ck_hp/validate/Makefile +++ b/regressions/ck_hp/validate/Makefile @@ -20,4 +20,4 @@ clean: rm -rf *~ *.o *.dSYM $(OBJECTS) include ../../../build/regressions.build -CFLAGS+=-pthread -D_GNU_SOURCE +CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE diff --git a/regressions/ck_pr/benchmark/Makefile b/regressions/ck_pr/benchmark/Makefile index d2ca7c0..c34afed 100644 --- a/regressions/ck_pr/benchmark/Makefile +++ b/regressions/ck_pr/benchmark/Makefile @@ -15,4 +15,4 @@ clean: rm -rf ck_pr_cas_64 ck_pr_fas_64 ck_pr_cas_64_2 *.dSYM include ../../../build/regressions.build -CFLAGS+=-pthread -D_GNU_SOURCE -lm +CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE -lm diff --git a/regressions/ck_pr/validate/Makefile b/regressions/ck_pr/validate/Makefile index 4bc6f0e..447a967 100644 --- a/regressions/ck_pr/validate/Makefile +++ b/regressions/ck_pr/validate/Makefile @@ -75,4 +75,3 @@ clean: rm -rf *~ *.o $(OBJECTS) *.dSYM include ../../../build/regressions.build -CFLAGS+=-fno-strict-aliasing diff --git a/regressions/ck_ring/validate/Makefile b/regressions/ck_ring/validate/Makefile index 3fe3e8a..64c0046 100644 --- a/regressions/ck_ring/validate/Makefile +++ b/regressions/ck_ring/validate/Makefile @@ -14,4 +14,4 @@ clean: rm -rf *~ *.o $(OBJECTS) *.dSYM include ../../../build/regressions.build -CFLAGS+=-pthread -D_GNU_SOURCE +CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE diff --git a/regressions/ck_sequence/validate/Makefile b/regressions/ck_sequence/validate/Makefile index 04147e9..0849928 100644 --- a/regressions/ck_sequence/validate/Makefile +++ b/regressions/ck_sequence/validate/Makefile @@ -12,4 +12,4 @@ clean: rm -rf *~ *.o $(OBJECTS) *.dSYM include ../../../build/regressions.build -CFLAGS+=-pthread -D_GNU_SOURCE -ggdb +CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE diff --git a/regressions/ck_spinlock/benchmark/Makefile b/regressions/ck_spinlock/benchmark/Makefile index a65eec5..da8866f 100644 --- a/regressions/ck_spinlock/benchmark/Makefile +++ b/regressions/ck_spinlock/benchmark/Makefile @@ -70,4 +70,4 @@ clean: rm -rf *.dSYM $(OBJECTS) include ../../../build/regressions.build -CFLAGS+=-D_GNU_SOURCE -pthread -lm +CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE -lm diff --git a/regressions/ck_spinlock/validate/Makefile b/regressions/ck_spinlock/validate/Makefile index da569e3..68fc00f 100644 --- a/regressions/ck_spinlock/validate/Makefile +++ b/regressions/ck_spinlock/validate/Makefile @@ -35,4 +35,4 @@ clean: ck_anderson test_and_set *.dSYM include ../../../build/regressions.build -CFLAGS+=-pthread -D_GNU_SOURCE -lm +CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE -lm diff --git a/regressions/ck_stack/benchmark/Makefile b/regressions/ck_stack/benchmark/Makefile index 61c3f6e..ddcdcd5 100644 --- a/regressions/ck_stack/benchmark/Makefile +++ b/regressions/ck_stack/benchmark/Makefile @@ -11,4 +11,4 @@ clean: rm -rf *~ *.o *.dSYM $(OBJECTS) include ../../../build/regressions.build -CFLAGS+=-pthread -D_GNU_SOURCE +CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE diff --git a/regressions/ck_stack/validate/Makefile b/regressions/ck_stack/validate/Makefile index fca24a7..a006237 100644 --- a/regressions/ck_stack/validate/Makefile +++ b/regressions/ck_stack/validate/Makefile @@ -17,19 +17,19 @@ mpnc_push mpmc_push upmc_push spinlock_push spinlock_eb_push: push.c $(CC) -DSPINLOCK -DEB $(CFLAGS) -o spinlock_eb_push push.c mpmc_pop upmc_pop spinlock_pop spinlock_eb_pop: pop.c - $(CC) -pthread -DMPMC $(CFLAGS) -o mpmc_pop pop.c - $(CC) -pthread -DUPMC $(CFLAGS) -o upmc_pop pop.c - $(CC) -pthread -DSPINLOCK $(CFLAGS) -o spinlock_pop pop.c - $(CC) -pthread -DEB -DSPINLOCK $(CFLAGS) -o spinlock_eb_pop pop.c + $(CC) -DMPMC $(CFLAGS) -o mpmc_pop pop.c + $(CC) -DUPMC $(CFLAGS) -o upmc_pop pop.c + $(CC) -DSPINLOCK $(CFLAGS) -o spinlock_pop pop.c + $(CC) -DEB -DSPINLOCK $(CFLAGS) -o spinlock_eb_pop pop.c mpmc_pair spinlock_pair spinlock_eb_pair pthreads_pair: pair.c - $(CC) -pthread -DMPMC $(CFLAGS) -o mpmc_pair pair.c - $(CC) -pthread -DSPINLOCK $(CFLAGS) -o spinlock_pair pair.c - $(CC) -pthread -DEB -DSPINLOCK $(CFLAGS) -o spinlock_eb_pair pair.c - $(CC) -pthread -DPTHREADS $(CFLAGS) -o pthreads_pair pair.c + $(CC) -DMPMC $(CFLAGS) -o mpmc_pair pair.c + $(CC) -DSPINLOCK $(CFLAGS) -o spinlock_pair pair.c + $(CC) -DEB -DSPINLOCK $(CFLAGS) -o spinlock_eb_pair pair.c + $(CC) -DPTHREADS $(CFLAGS) -o pthreads_pair pair.c clean: rm -rf *~ *.o *.dSYM $(OBJECTS) include ../../../build/regressions.build -CFLAGS+=-pthread -D_GNU_SOURCE +CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE diff --git a/src/Makefile b/src/Makefile index 8836ca0..92a084e 100644 --- a/src/Makefile +++ b/src/Makefile @@ -10,7 +10,7 @@ OBJECTS=ck_hp.o \ all: libck.so libck.a libck.so: $(OBJECTS) - $(CC) $(CFLAGS) -shared -fPIC -o libck.so $(OBJECTS) + $(LD) $(LDFLAGS) -o libck.so $(OBJECTS) libck.a: $(OBJECTS) ar rcs libck.a $(OBJECTS)