From fed8b0c5e3ea6e4f0ac272cf705c7f2cad3f9d84 Mon Sep 17 00:00:00 2001
From: Andreas Beckmann <anbe@debian.org>
Date: Tue, 20 Feb 2024 00:31:36 +0100
Subject: [PATCH] sde tests: create lib dir if needed

---
 src/components/sde/tests/Makefile | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/src/components/sde/tests/Makefile b/src/components/sde/tests/Makefile
index 324c4fd57..3f2a406b8 100644
--- a/src/components/sde/tests/Makefile
+++ b/src/components/sde/tests/Makefile
@@ -42,6 +42,9 @@ endif
 
 sde_tests: $(TESTS)
 
+lib:
+	mkdir $@
+
 ################################################################################
 ## Minimal test
 prfx=Minimal
@@ -56,7 +59,7 @@ Minimal_Test++: $(prfx)/Minimal_Test++.cpp
 ## Simple test
 prfx=Simple
 
-libSimple.so: $(prfx)/Simple_Lib.c
+libSimple.so: $(prfx)/Simple_Lib.c | lib
 	$(CC) -shared -Wall -fPIC $(CFLAGS) $(LDFLAGS) $(INCLUDE) -o lib/$@ $^
 
 Simple_Test: $(prfx)/Simple_Driver.c libSimple.so
@@ -66,7 +69,7 @@ Simple_Test: $(prfx)/Simple_Driver.c libSimple.so
 ## Simple2 test
 prfx=Simple2
 
-libSimple2.so: $(prfx)/Simple2_Lib.c
+libSimple2.so: $(prfx)/Simple2_Lib.c | lib
 	$(CC) -shared -Wall -fPIC $(CFLAGS) $(LDFLAGS) $(INCLUDE) -o lib/$@ $^
 
 Simple2_Test: $(prfx)/Simple2_Driver.c libSimple2.so
@@ -75,7 +78,7 @@ Simple2_Test: $(prfx)/Simple2_Driver.c libSimple2.so
 Simple2_NoPAPI_Test: $(prfx)/Simple2_NoPAPI_Driver.c libSimple2.so
 	$(CC) $< -o $@ $(INCLUDE) $(CFLAGS) $(LDFLAGS) -Llib -lSimple2 -L$(datadir) -lsde -lm -ldl
 
-libSimple2++.so: $(prfx)/Simple2_Lib++.cpp
+libSimple2++.so: $(prfx)/Simple2_Lib++.cpp | lib
 	$(CXX) -shared -Wall -fPIC $(CXXFLAGS) $(LDFLAGS) $(INCLUDE) -o lib/$@ $^
 
 Simple2_Test++: $(prfx)/Simple2_Driver++.cpp libSimple2++.so
@@ -85,13 +88,13 @@ Simple2_Test++: $(prfx)/Simple2_Driver++.cpp libSimple2++.so
 ## Recorder test
 prfx=Recorder
 
-libRecorder.so: $(prfx)/Lib_With_Recorder.c
+libRecorder.so: $(prfx)/Lib_With_Recorder.c | lib
 	$(CC) -shared -Wall -fPIC $(CFLAGS) $(LDFLAGS) $(INCLUDE) -o lib/$@ $^
 
 Recorder_Test: $(prfx)/Recorder_Driver.c libRecorder.so
 	$(CC) $< -o $@ $(INCLUDE) $(CFLAGS) $(UTILOBJS) -lRecorder $(LDFLAGS) -lm
 
-libRecorder++.so: $(prfx)/Lib_With_Recorder++.cpp
+libRecorder++.so: $(prfx)/Lib_With_Recorder++.cpp | lib
 	$(CXX) -shared -Wall -fPIC $(CXXFLAGS) $(LDFLAGS) $(INCLUDE) -o lib/$@ $^
 
 Recorder_Test++: $(prfx)/Recorder_Driver++.cpp libRecorder++.so
@@ -102,10 +105,10 @@ Recorder_Test++: $(prfx)/Recorder_Driver++.cpp libRecorder++.so
 ## Created Counter test
 prfx=Created_Counter
 
-libCreated_Counter.so: $(prfx)/Lib_With_Created_Counter.c
+libCreated_Counter.so: $(prfx)/Lib_With_Created_Counter.c | lib
 	$(CC) -shared -Wall -fPIC $(CFLAGS) $(LDFLAGS) $(INCLUDE) -o lib/$@ $^
 
-libCreated_Counter_static.a: $(prfx)/Lib_With_Created_Counter.c
+libCreated_Counter_static.a: $(prfx)/Lib_With_Created_Counter.c | lib
 	$(CC) -Bstatic -static -Wall $(CFLAGS) $(INCLUDE) -c -o lib/Lib_With_Created_Counter.o $^
 	ar rs lib/$@ lib/Lib_With_Created_Counter.o
 	rm lib/Lib_With_Created_Counter.o
@@ -117,7 +120,7 @@ Overflow_Test: $(prfx)/Overflow_Driver.c libCreated_Counter.so
 Overflow_Static_Test: $(prfx)/Overflow_Driver.c libCreated_Counter_static.a
 	$(CC) $< -o $@ $(INCLUDE) $(CFLAGS) $(LDFLAGS) $(UTILOBJS) lib/libCreated_Counter_static.a $(datadir)/libpapi.a $(datadir)/libsde.a -lpfm -ldl -lrt
 
-libCreated_Counter++.so: $(prfx)/Lib_With_Created_Counter++.cpp
+libCreated_Counter++.so: $(prfx)/Lib_With_Created_Counter++.cpp | lib
 	$(CXX) -shared -Wall -fPIC $(CXXFLAGS) $(LDFLAGS) $(INCLUDE) -o lib/$@ $^
 
 Created_Counter_Test++: $(prfx)/Created_Counter_Driver++.cpp libCreated_Counter++.so
@@ -127,7 +130,7 @@ Created_Counter_Test++: $(prfx)/Created_Counter_Driver++.cpp libCreated_Counter+
 ## Counting Set test
 prfx=Counting_Set
 
-libCounting_Set++.so: $(prfx)/CountingSet_Lib++.cpp $(prfx)/cset_lib.hpp
+libCounting_Set++.so: $(prfx)/CountingSet_Lib++.cpp $(prfx)/cset_lib.hpp | lib
 	$(CXX) -shared -Wall -fPIC $(CXXFLAGS) $(LDFLAGS) $(INCLUDE) -o lib/$@ $<
 
 Counting_Set_MemLeak_Test++: $(prfx)/MemoryLeak_CountingSet_Driver++.cpp libCounting_Set++.so
@@ -136,7 +139,7 @@ Counting_Set_MemLeak_Test++: $(prfx)/MemoryLeak_CountingSet_Driver++.cpp libCoun
 Counting_Set_Simple_Test++: $(prfx)/Simple_CountingSet_Driver++.cpp libCounting_Set++.so
 	$(CXX) $< -o $@ $(INCLUDE) $(CXXFLAGS) $(UTILOBJS) -lCounting_Set++ $(LDFLAGS)
 
-libCounting_Set.so: $(prfx)/CountingSet_Lib.c
+libCounting_Set.so: $(prfx)/CountingSet_Lib.c | lib
 	$(CC) -shared -Wall -fPIC $(CFLAGS) $(LDFLAGS) $(INCLUDE) -o lib/$@ $^
 
 Counting_Set_Simple_Test: $(prfx)/Simple_CountingSet_Driver.c libCounting_Set.so
@@ -150,10 +153,10 @@ Counting_Set_MemLeak_Test: $(prfx)/MemoryLeak_CountingSet_Driver.c libCounting_S
 prfx=Advanced_C+FORTRAN
 rcrd_prfx=Recorder
 
-libXandria.so: $(prfx)/Xandria.F90
+libXandria.so: $(prfx)/Xandria.F90 | lib
 	$(F77) -shared -Wall -fPIC $(FFLAGS) $(LDFLAGS) $(INCLUDE) -o lib/$@ $(SDE_F08_API) $<
 
-libGamum.so: $(prfx)/Gamum.c
+libGamum.so: $(prfx)/Gamum.c | lib
 	$(CC) -shared -Wall -fPIC $(CFLAGS) $(LDFLAGS) $(INCLUDE) -o lib/$@ $^
 
 sde_test_f08: $(prfx)/sde_test_f08.F90 $(UTILOBJS) $(PAPILIB) libXandria.so libGamum.so libRecorder.so
-- 
2.20.1

