With make, build query_config.c only once

Build query_config.o then link it, instead of building query_config.c
in each of the four programs that use it.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
Gilles Peskine 2021-01-05 20:59:50 +01:00
parent e9e0388934
commit f06a54cb18
3 changed files with 17 additions and 9 deletions

3
programs/.gitignore vendored
View file

@ -2,6 +2,9 @@
*.sln *.sln
*.vcxproj *.vcxproj
*.o
*.exe
aes/aescrypt2 aes/aescrypt2
aes/crypt_and_hash aes/crypt_and_hash
hash/generic_sum hash/generic_sum

View file

@ -267,21 +267,23 @@ ssl/ssl_client1$(EXEXT): ssl/ssl_client1.c $(DEP)
echo " CC ssl/ssl_client1.c" echo " CC ssl/ssl_client1.c"
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_client1.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_client1.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
ssl/ssl_client2$(EXEXT): ssl/ssl_client2.c test/query_config.c $(DEP) SSL_TEST_OBJECTS = test/query_config.o
ssl/ssl_client2$(EXEXT): ssl/ssl_client2.c $(SSL_TEST_OBJECTS) $(DEP)
echo " CC ssl/ssl_client2.c" echo " CC ssl/ssl_client2.c"
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_client2.c test/query_config.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_client2.c $(SSL_TEST_OBJECTS) $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
ssl/ssl_server$(EXEXT): ssl/ssl_server.c $(DEP) ssl/ssl_server$(EXEXT): ssl/ssl_server.c $(DEP)
echo " CC ssl/ssl_server.c" echo " CC ssl/ssl_server.c"
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_server.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_server.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
ssl/ssl_server2$(EXEXT): ssl/ssl_server2.c test/query_config.c $(DEP) ssl/ssl_server2$(EXEXT): ssl/ssl_server2.c $(SSL_TEST_OBJECTS) $(DEP)
echo " CC ssl/ssl_server2.c" echo " CC ssl/ssl_server2.c"
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_server2.c test/query_config.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_server2.c $(SSL_TEST_OBJECTS) $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
ssl/ssl_context_info$(EXEXT): ssl/ssl_context_info.c test/query_config.c $(DEP) ssl/ssl_context_info$(EXEXT): ssl/ssl_context_info.c test/query_config.o $(DEP)
echo " CC ssl/ssl_context_info.c" echo " CC ssl/ssl_context_info.c"
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_context_info.c test/query_config.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_context_info.c test/query_config.o $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
ssl/ssl_fork_server$(EXEXT): ssl/ssl_fork_server.c $(DEP) ssl/ssl_fork_server$(EXEXT): ssl/ssl_fork_server.c $(DEP)
echo " CC ssl/ssl_fork_server.c" echo " CC ssl/ssl_fork_server.c"
@ -307,6 +309,10 @@ test/cpp_dummy_build$(EXEXT): test/cpp_dummy_build.cpp $(DEP)
echo " CXX test/cpp_dummy_build.cpp" echo " CXX test/cpp_dummy_build.cpp"
$(CXX) $(LOCAL_CXXFLAGS) $(CXXFLAGS) test/cpp_dummy_build.cpp $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ $(CXX) $(LOCAL_CXXFLAGS) $(CXXFLAGS) test/cpp_dummy_build.cpp $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
test/query_config.o: test/query_config.c $(DEP)
echo " CC test/query_config.c"
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) -c test/query_config.c -o $@
test/selftest$(EXEXT): test/selftest.c $(DEP) test/selftest$(EXEXT): test/selftest.c $(DEP)
echo " CC test/selftest.c" echo " CC test/selftest.c"
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) test/selftest.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ $(CC) $(LOCAL_CFLAGS) $(CFLAGS) test/selftest.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
@ -319,9 +325,9 @@ test/zeroize$(EXEXT): test/zeroize.c $(DEP)
echo " CC test/zeroize.c" echo " CC test/zeroize.c"
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) test/zeroize.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ $(CC) $(LOCAL_CFLAGS) $(CFLAGS) test/zeroize.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
test/query_compile_time_config$(EXEXT): test/query_compile_time_config.c test/query_config.c $(DEP) test/query_compile_time_config$(EXEXT): test/query_compile_time_config.c test/query_config.o $(DEP)
echo " CC test/query_compile_time_config.c" echo " CC test/query_compile_time_config.c"
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) test/query_compile_time_config.c test/query_config.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ $(CC) $(LOCAL_CFLAGS) $(CFLAGS) test/query_compile_time_config.c test/query_config.o $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
util/pem2der$(EXEXT): util/pem2der.c $(DEP) util/pem2der$(EXEXT): util/pem2der.c $(DEP)
echo " CC util/pem2der.c" echo " CC util/pem2der.c"

View file

@ -1,4 +1,3 @@
*.o
fuzz_client fuzz_client
fuzz_dtlsclient fuzz_dtlsclient
fuzz_dtlsserver fuzz_dtlsserver