From e15bbb64e049c703d8a62eff380582b42985921a Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 11 Dec 2023 18:11:44 -0800 Subject: [PATCH] Sample apps (worker, wrapper, vboxwrapper): change Linux Makefile to add version# / platform to executable name NOTE: all files that will get sent to a BOINC client should have a version number in the filename; if they're executable code they should also have a platform name in the filename. It would be nice to centralize these version numbers (like in version.h). For now they're scattered around project files and Makefiles --- samples/vboxwrapper/Makefile | 8 +++--- samples/worker/Makefile | 8 +++--- samples/worker/worker.cpp | 47 +++++++++++++++++++++--------------- samples/wrapper/Makefile | 8 +++--- version.h | 12 ++++++--- 5 files changed, 52 insertions(+), 31 deletions(-) diff --git a/samples/vboxwrapper/Makefile b/samples/vboxwrapper/Makefile index 470d463f89..4b72668206 100644 --- a/samples/vboxwrapper/Makefile +++ b/samples/vboxwrapper/Makefile @@ -1,5 +1,7 @@ # This should work on Linux. Modify as needed for other platforms. +VBOXWRAPPER_RELEASE = 26207_x86_64-pc-linux-gnu + # Change the following to match your installation BOINC_DIR = ../.. BOINC_SOURCE_API_DIR = $(BOINC_DIR)/api @@ -31,7 +33,7 @@ CXXFLAGS += -g \ -L$(BOINC_LIB_DIR) \ -L. -PROGS = vboxwrapper +PROGS = vboxwrapper_$(VBOXWRAPPER_RELEASE) HEADERS = vbox_common.h vboxjob.h vbox_vboxmanage.h vboxwrapper.h @@ -66,5 +68,5 @@ vboxlogging.o: vboxlogging.cpp $(HEADERS) vboxwrapper.o: vboxwrapper.cpp $(HEADERS) $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c vboxwrapper.cpp -vboxwrapper: vboxwrapper.o vbox_common.o vbox_vboxmanage.o vboxcheckpoint.o vboxjob.o vboxlogging.o floppyio.o $(MAKEFILE_STDLIB) $(BOINC_LIB_DIR)/libboinc.a $(BOINC_API_DIR)/libboinc_api.a - $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o vboxwrapper vboxwrapper.o vbox_common.o vbox_vboxmanage.o vboxcheckpoint.o vboxjob.o vboxlogging.o floppyio.o $(MAKEFILE_LDFLAGS) -lboinc_api -lboinc $(STDCPPTC) +vboxwrapper_$(VBOXWRAPPER_RELEASE): vboxwrapper.o vbox_common.o vbox_vboxmanage.o vboxcheckpoint.o vboxjob.o vboxlogging.o floppyio.o $(MAKEFILE_STDLIB) $(BOINC_LIB_DIR)/libboinc.a $(BOINC_API_DIR)/libboinc_api.a + $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o vboxwrapper_$(VBOXWRAPPER_RELEASE) vboxwrapper.o vbox_common.o vbox_vboxmanage.o vboxcheckpoint.o vboxjob.o vboxlogging.o floppyio.o $(MAKEFILE_LDFLAGS) -lboinc_api -lboinc $(STDCPPTC) diff --git a/samples/worker/Makefile b/samples/worker/Makefile index 2c849c71db..942373cba3 100644 --- a/samples/worker/Makefile +++ b/samples/worker/Makefile @@ -1,7 +1,9 @@ CXXFLAGS += -g CXX ?= g++ -PROGS = worker +WORKER_RELEASE = 1_x86_64-pc-linux-gnu + +PROGS = worker_$(WORKER_RELEASE) all: $(PROGS) @@ -10,8 +12,8 @@ clean: distclean distclean: rm -f $(PROGS) $(addsuffix .exe, $(PROGS)) *.o -worker: worker.o - $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o worker worker.o +worker_$(WORKER_RELEASE): worker.o + $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o worker_$(WORKER_RELEASE) worker.o install: all diff --git a/samples/worker/worker.cpp b/samples/worker/worker.cpp index 65030763f8..a699c69f28 100644 --- a/samples/worker/worker.cpp +++ b/samples/worker/worker.cpp @@ -16,20 +16,22 @@ // along with BOINC. If not, see . // worker - application without BOINC runtime system; -// used for testing wrapper. +// used for testing wrappers. // -// worker [--std_copy] [--file_copy] nsecs +// worker [--std] [--file] nsecs // -// --std_copy: copy one line of stdin to stdout -// --file_copy: copy one line of "in" to "out" +// --std: stdin to stdout +// --file_copy: "in" to "out" +// In both cases, convert to uppercase // nsecs: use this much CPU time (default 10 sec) // -// THIS PROGRAM SHOULDN'T USE ANY BOINC CODE. That's the whole point. +// THIS PROGRAM CAN'T USE ANY BOINC CODE. That's the whole point. #include #include #include #include +#include // do a billion floating-point ops // (note: I needed to add an arg to this; @@ -46,25 +48,34 @@ static double do_a_giga_flop(int foo) { return x; } +void copy_uc(FILE* fin, FILE* fout) { + int c; + while (1) { + c = fgetc(fin); + if (c == EOF) break; + fputc(toupper(c), fout); + } +} + int main(int argc, char** argv) { - char buf[256]; FILE* in, *out; int i, nsec = 10; - bool std_copy = false, file_copy = false; + bool std = false, file = false; + char c; for (i=1; i