[ros-diffs] [cfinck] 30624: Start sharing some tools between RosBE-Windows and RosBE-Unix, beginning with "cpucount" - Create a portable version (Windows, Mac OS X, other Unices) of "cpucount" based on the RosBE-Unix version along with a universal Makefile and a Readme file - Remove the other versions of "cpucount" - Remove the LFLAGS option from the RosBE-Windows Tools Makefile, it was never used. Instead add a STRIP option and use it for every target. - Set WINVER in the RosBE-Windows Tools Makefile to 0x500 to ensure that no one uses API's, which are not compatible with Windows 2000 and XP
cfinck at svn.reactos.org
cfinck at svn.reactos.org
Wed Nov 21 14:49:44 CET 2007
Author: cfinck
Date: Wed Nov 21 16:49:44 2007
New Revision: 30624
URL: http://svn.reactos.org/svn/reactos?rev=30624&view=rev
Log:
Start sharing some tools between RosBE-Windows and RosBE-Unix, beginning with "cpucount"
- Create a portable version (Windows, Mac OS X, other Unices) of "cpucount" based on the RosBE-Unix version along with a universal Makefile and a Readme file
- Remove the other versions of "cpucount"
- Remove the LFLAGS option from the RosBE-Windows Tools Makefile, it was never used.
Instead add a STRIP option and use it for every target.
- Set WINVER in the RosBE-Windows Tools Makefile to 0x500 to ensure that no one uses API's, which are not compatible with Windows 2000 and XP
Added:
trunk/tools/RosBE/Tools/ (with props)
trunk/tools/RosBE/Tools/SVN-Readme.txt (with props)
trunk/tools/RosBE/Tools/cpucount.c (with props)
trunk/tools/RosBE/Tools/makefile (with props)
Removed:
trunk/tools/RosBE/RosBE-Unix/tools/cpucount.c
trunk/tools/RosBE/RosBE-Windows/Tools/cpucount.c
Modified:
trunk/tools/RosBE/RosBE-Windows/Tools/ (props changed)
trunk/tools/RosBE/RosBE-Windows/Tools/makefile
Removed: trunk/tools/RosBE/RosBE-Unix/tools/cpucount.c
URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Unix/tools/cpucount.c?rev=30623&view=auto
==============================================================================
--- trunk/tools/RosBE/RosBE-Unix/tools/cpucount.c (original)
+++ trunk/tools/RosBE/RosBE-Unix/tools/cpucount.c (removed)
@@ -1,55 +1,0 @@
-/* Program for printing the CPU count.
- The output value will be used for the -j option of gcc.
-
- Developed by Colin Finck <mail at colinfinck.de>
- Released under GNU GPL v2 or any later version.
-*/
-
-#include <stdio.h>
-#include <unistd.h>
-#ifdef __APPLE__
-#include <sys/sysctl.h>
-#endif
-
-int main(int argc, char *argv[])
-{
- int cpuCount = 0;
-
- if(argc > 2)
- {
- fprintf(stderr, "%s: Error too many parameters specified.\n", argv[0]);
- return -1;
- }
-
-#ifdef __APPLE__
- size_t countSize = sizeof(cpuCount);
-
- sysctlbyname("hw.logicalcpu", &cpuCount, &countSize, NULL, 0);
-#else
- cpuCount = sysconf(_SC_NPROCESSORS_ONLN);
-#endif
-
- if(argc != 1)
- {
- if(!strncmp(argv[1], "-x1", 3))
- {
- cpuCount++;
- }
- else if(!strncmp(argv[1], "-x2", 3))
- {
- cpuCount += cpuCount;
- }
- else
- {
- printf("Usage: %s [OPTIONS]\n", argv[0]);
- printf("Running cpucount without options returns the number of\n");
- printf("processors in the system.\n");
- printf("-x1 - Number of processors in the system, plus 1.\n");
- printf("-x2 - Number of processors in the system, doubled.\n");
- return 0;
- }
- }
-
- printf("%u\n", cpuCount);
- return 0;
-}
Propchange: trunk/tools/RosBE/RosBE-Windows/Tools/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Nov 21 16:49:44 2007
@@ -1,0 +1,1 @@
+*.exe
Removed: trunk/tools/RosBE/RosBE-Windows/Tools/cpucount.c
URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Tools/cpucount.c?rev=30623&view=auto
==============================================================================
--- trunk/tools/RosBE/RosBE-Windows/Tools/cpucount.c (original)
+++ trunk/tools/RosBE/RosBE-Windows/Tools/cpucount.c (removed)
@@ -1,49 +1,0 @@
-/*
- * PROJECT: RosBE - ReactOS Build Environment for Windows.
- * LICENSE: GPL - See LICENSE.txt in the top level directory.
- * FILE: Tools/cpucount.c
- * PURPOSE: CPU Core Counter
- * COPYRIGHT: Copyright 2007 Christoph von Wittich <Christoph_vW at reactos.org>
- * Copyright 2007 Peter Ward <dralnix at gmail.com>
- *
- */
-
-#include <windows.h>
-#include <stdio.h>
-
-int main(int argc, char* argv[])
-{
- SYSTEM_INFO SystemInformation;
-
- if (argc > 2)
- {
- fprintf(stderr, "%s: Error too many parameters specified.\n", argv[0]);
- return -1;
- }
-
- GetSystemInfo(&SystemInformation);
-
- if(argc != 1)
- {
- if(!strncmp(argv[1], "-x1", 3))
- {
- SystemInformation.dwNumberOfProcessors++;
- }
- else if(!strncmp(argv[1], "-x2", 3))
- {
- SystemInformation.dwNumberOfProcessors += SystemInformation.dwNumberOfProcessors;
- }
- else
- {
- printf("Usage: %s [OPTIONS]\n", argv[0]);
- printf("Running cpucount without options returns the number of\n");
- printf("processors in the system.\n");
- printf("-x1 - Number of processors in the system, plus 1.\n");
- printf("-x2 - Number of processors in the system, doubled.\n");
- return 0;
- }
- }
-
- printf("%u\n", SystemInformation.dwNumberOfProcessors);
- return 0;
-}
Modified: trunk/tools/RosBE/RosBE-Windows/Tools/makefile
URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Tools/makefile?rev=30624&r1=30623&r2=30624&view=diff
==============================================================================
--- trunk/tools/RosBE/RosBE-Windows/Tools/makefile (original)
+++ trunk/tools/RosBE/RosBE-Windows/Tools/makefile Wed Nov 21 16:49:44 2007
@@ -4,37 +4,43 @@
CC := gcc
CFLAGS := ${HOST_CFLAGS} -Wall -O2 -o
-LFLAGS := -s
-WINVER := 0x502
+STRIP := strip
+SUFFIX := .exe
+WINVER := 0x500
-all: buildtime chknewer chkslash cpucount echoh flash getdate scut tee
+all: buildtime chknewer chkslash echoh flash getdate scut tee
buildtime: buildtime.c
- ${CC} ${CFLAGS} buildtime buildtime.c
+ ${CC} ${CFLAGS} buildtime$(SUFFIX) buildtime.c
+ $(STRIP) buildtime$(SUFFIX)
chknewer: chknewer.c
${CC} ${CFLAGS} chknewer chknewer.c
+ $(STRIP) chknewer$(SUFFIX)
chkslash: chkslash.c
${CC} ${CFLAGS} chkslash chkslash.c
-
-cpucount: cpucount.c
- ${CC} ${CFLAGS} cpucount cpucount.c
+ $(STRIP) chkslash$(SUFFIX)
echoh: echoh.c
${CC} ${CFLAGS} echoh echoh.c
+ $(STRIP) echoh$(SUFFIX)
flash: flash.c
${CC} -DWINVER=${WINVER} -D_WIN32_WINNT=${WINVER} ${CFLAGS} flash flash.c
+ $(STRIP) flash$(SUFFIX)
getdate: getdate.c
${CC} ${CFLAGS} getdate getdate.c
+ $(STRIP) getdate$(SUFFIX)
scut: scut.c
${CC} ${CFLAGS} scut scut.c
+ $(STRIP) scut$(SUFFIX)
tee: tee.c
${CC} ${CFLAGS} tee tee.c
+ $(STRIP) tee$(SUFFIX)
clean:
- del /f buildtime.exe chknewer.exe chkslash.exe cpucount.exe echoh.exe flash.exe getdate.exe scut.exe tee.exe
+ del /f buildtime.exe chknewer.exe chkslash.exe echoh.exe flash.exe getdate.exe scut.exe tee.exe
Propchange: trunk/tools/RosBE/Tools/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Nov 21 16:49:44 2007
@@ -1,0 +1,1 @@
+*.exe
Added: trunk/tools/RosBE/Tools/SVN-Readme.txt
URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/Tools/SVN-Readme.txt?rev=30624&view=auto
==============================================================================
--- trunk/tools/RosBE/Tools/SVN-Readme.txt (added)
+++ trunk/tools/RosBE/Tools/SVN-Readme.txt Wed Nov 21 16:49:44 2007
@@ -1,0 +1,9 @@
+This directory contains tools shared between RosBE-Windows and RosBE-Unix.
+
+For RosBE-Windows
+------------------
+ The built tools need to be copied to RosBE-Windows\Root\Tools
+
+For RosBE-Unix
+---------------
+ The source files of the tools need to be copied to RosBE-Unix/tools
Propchange: trunk/tools/RosBE/Tools/SVN-Readme.txt
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/tools/RosBE/Tools/cpucount.c
URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/Tools/cpucount.c?rev=30624&view=auto
==============================================================================
--- trunk/tools/RosBE/Tools/cpucount.c (added)
+++ trunk/tools/RosBE/Tools/cpucount.c Wed Nov 21 16:49:44 2007
@@ -1,0 +1,69 @@
+/*
+ * PROJECT: ReactOS Build Environment Tools
+ * LICENSE: GPL - See LICENSE.txt in the top level directory.
+ * FILE: Tools/cpucount.c
+ * PURPOSE: CPU Core Counter
+ * COPYRIGHT: Copyright 2007 Christoph von Wittich <Christoph_vW at reactos.org>
+ * Copyright 2007 Colin Finck <mail at colinfinck.de>
+ * Copyright 2007 Peter Ward <dralnix at gmail.com>
+ *
+ */
+
+#if defined(WIN32)
+# include <windows.h>
+#elif defined(__APPLE__)
+# include <sys/sysctl.h>
+#else
+# include <unistd.h>
+#endif
+
+#include <stdio.h>
+#include <string.h>
+
+int main(int argc, char *argv[])
+{
+ int cpuCount = 0;
+
+ if(argc > 2)
+ {
+ fprintf(stderr, "%s: Error too many parameters specified.\n", argv[0]);
+ return -1;
+ }
+
+#if defined(WIN32)
+ SYSTEM_INFO SystemInformation;
+
+ GetSystemInfo(&SystemInformation);
+ cpuCount = SystemInformation.dwNumberOfProcessors;
+#elif defined(__APPLE__)
+ size_t countSize = sizeof(cpuCount);
+
+ sysctlbyname("hw.logicalcpu", &cpuCount, &countSize, NULL, 0);
+#else
+ cpuCount = sysconf(_SC_NPROCESSORS_ONLN);
+#endif
+
+ if(argc != 1)
+ {
+ if(!strncmp(argv[1], "-x1", 3))
+ {
+ cpuCount++;
+ }
+ else if(!strncmp(argv[1], "-x2", 3))
+ {
+ cpuCount += cpuCount;
+ }
+ else
+ {
+ printf("Usage: %s [OPTIONS]\n", argv[0]);
+ printf("Running cpucount without options returns the number of\n");
+ printf("processors in the system.\n");
+ printf("-x1 - Number of processors in the system, plus 1.\n");
+ printf("-x2 - Number of processors in the system, doubled.\n");
+ return 0;
+ }
+ }
+
+ printf("%u\n", cpuCount);
+ return 0;
+}
Propchange: trunk/tools/RosBE/Tools/cpucount.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/tools/RosBE/Tools/makefile
URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/Tools/makefile?rev=30624&view=auto
==============================================================================
--- trunk/tools/RosBE/Tools/makefile (added)
+++ trunk/tools/RosBE/Tools/makefile Wed Nov 21 16:49:44 2007
@@ -1,0 +1,27 @@
+# makefile - Simple makefile to build the various RosBE tools.
+
+.PHONY: all clean
+
+CC := gcc
+CFLAGS := ${HOST_CFLAGS} -Wall -O2 -o
+STRIP := strip
+
+ifeq ($(word 1,$(shell gcc -dumpmachine)),mingw32)
+ # Windows host
+ RM := del /f
+ SUFFIX := .exe
+else
+ # Unix host
+ RM := rm -f
+ SUFFIX :=
+endif
+
+
+all: cpucount
+
+cpucount: cpucount.c
+ ${CC} ${CFLAGS} cpucount$(SUFFIX) cpucount.c
+ $(STRIP) cpucount$(SUFFIX)
+
+clean:
+ $(RM) cpucount$(SUFFIX)
Propchange: trunk/tools/RosBE/Tools/makefile
------------------------------------------------------------------------------
svn:eol-style = native
More information about the Ros-diffs
mailing list