diff --git a/reactos/ntoskrnl/.cvsignore b/reactos/ntoskrnl/.cvsignore index ded8d6d2be7..dfcf970115b 100644 --- a/reactos/ntoskrnl/.cvsignore +++ b/reactos/ntoskrnl/.cvsignore @@ -4,4 +4,6 @@ ntoskrnl.coff objects temp.exp depends -depends.exe \ No newline at end of file +depends.exe +mkconfig +mkconfig.exe diff --git a/reactos/ntoskrnl/Makefile b/reactos/ntoskrnl/Makefile index f1703349921..cbdf1d616bc 100644 --- a/reactos/ntoskrnl/Makefile +++ b/reactos/ntoskrnl/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.31 2001/04/10 17:48:16 dwelch Exp $ +# $Id: Makefile,v 1.32 2001/04/10 22:13:22 dwelch Exp $ # # ReactOS Operating System # @@ -9,24 +9,9 @@ PATH_TO_TOP := .. # -# Architecture to build for +# Include details of the kernel configuration # -ARCH := i386 - -# -# Whether to compile in the kernel debugger -# -KDBG := 1 - -# -# Whether to compile for debugging -# -DBG := 1 - -# -# Whether to compile a multiprocessor or single processor version -# -MP := 0 +include config # # @@ -62,7 +47,7 @@ CFLAGS = -Iinclude -D__NTOSKRNL__ $(CFLAGS_DBG) -Wall -Werror include $(PATH_TO_TOP)/rules.mak -all: config $(EXE_PREFIX)depends$(EXE_POSTFIX) \ +all: $(EXE_PREFIX)depends$(EXE_POSTFIX) \ $(OBJECTS_PATH) \ $(TARGETNAME).nostrip.exe \ $(TARGETNAME).exe \ @@ -616,12 +601,12 @@ ke/main.o: ke/main.c ../include/reactos/buildno.h mkconfig$(EXE_SUFFIX): mkconfig.c $(HOST_CC) -g -o mkconfig$(EXE_SUFFIX) mkconfig.c -config: - $(EXE_PREFIX)mkconfig$(EXE_SUFFIX) include/internal/config.h $(CONFIG) - -.PHONY: config +include/internal/config.h: config mkconfig$(EXE_SUFFIX) + $(EXE_PREFIX)mkconfig$(EXE_SUFFIX) include/internal/config.h$(CONFIG) +ifneq ($(MAKECMDGOALS),clean) include $(D1_FILES) +endif .%.d: %.c $(EXE_PREFIX)depends$(EXE_POSTFIX) $(CC) $(CFLAGS) -M $< | $(EXE_PREFIX)depends$(EXE_POSTFIX) $(@D) $@ diff --git a/reactos/ntoskrnl/config b/reactos/ntoskrnl/config new file mode 100644 index 00000000000..6641f79a08e --- /dev/null +++ b/reactos/ntoskrnl/config @@ -0,0 +1,19 @@ +# +# Architecture to build for +# +ARCH := i386 + +# +# Whether to compile in the kernel debugger +# +KDBG := 0 + +# +# Whether to compile for debugging +# +DBG := 1 + +# +# Whether to compile a multiprocessor or single processor version +# +MP := 0 diff --git a/reactos/ntoskrnl/include/internal/config.h b/reactos/ntoskrnl/include/internal/config.h index 02bb0ff63c2..e1775bd5f39 100644 --- a/reactos/ntoskrnl/include/internal/config.h +++ b/reactos/ntoskrnl/include/internal/config.h @@ -1,4 +1,7 @@ -/* Automatically generated, don't edit */ +/* Automatically generated, Edit the Makefile to change configuration */ +#ifndef __NTOSKRNL_INCLUDE_INTERNAL_CONFIG_H +#define __NTOSKRNL_INCLUDE_INTERNAL_CONFIG_H #define DBG -#define KDBG #define UP +#define CONFIG "DBG UP" +#endif /* __NTOSKRNL_INCLUDE_INTERNAL_CONFIG_H */ diff --git a/reactos/ntoskrnl/mkconfig.c b/reactos/ntoskrnl/mkconfig.c index 5766afef97e..56bb885dc08 100644 --- a/reactos/ntoskrnl/mkconfig.c +++ b/reactos/ntoskrnl/mkconfig.c @@ -44,7 +44,7 @@ write_if_change(char* outbuf, char* filename) fclose(out); return(1); } - if (memcmp(cmpbuf, outbuf, max(end, strlen(outbuf))) == 0) + if (end == strlen(outbuf) && memcmp(cmpbuf, outbuf, end) == 0) { fclose(out); return(0); @@ -75,6 +75,7 @@ main(int argc, char* argv[]) unsigned int i; char* outbuf; char* s; + char config[512]; if (argc == 1) { @@ -90,11 +91,22 @@ main(int argc, char* argv[]) } s = outbuf; - s = s + sprintf(s, "/* Automatically generated, don't edit */\n"); + s = s + sprintf(s, "/* Automatically generated, "); + s = s + sprintf(s, "Edit the Makefile to change configuration */\n"); + s = s + sprintf(s, "#ifndef __NTOSKRNL_INCLUDE_INTERNAL_CONFIG_H\n"); + s = s + sprintf(s, "#define __NTOSKRNL_INCLUDE_INTERNAL_CONFIG_H\n"); + strcpy(config, ""); for (i = 2; i < argc; i++) { s = s + sprintf(s, "#define %s\n", argv[i]); + strcat(config, argv[i]); + if (i != (argc - 1)) + { + strcat(config, " "); + } } + s = s + sprintf(s, "#define CONFIG \"%s\"\n", config); + s = s + sprintf(s, "#endif /* __NTOSKRNL_INCLUDE_INTERNAL_CONFIG_H */\n"); return(write_if_change(outbuf, argv[1])); }