Common subdirectories: make.org/.svn and make/.svn diff -N -u make.org/GNUmakefile make/GNUmakefile --- make.org/GNUmakefile 1970-01-01 03:00:00.000000000 +0300 +++ make/GNUmakefile 2008-08-06 18:08:18.437072900 +0400 @@ -0,0 +1,115 @@ +# Cygwin - gnuMakefile for BSDmake +# See at end for SVN repo checkout + +PROG= make +CFLAGS+=-O2 -I${.CURDIR} -Wall +LDFLAGS+=-static +SRCS= arch.c buf.c cond.c dir.c for.c hash.c hash_tables.c job.c \ + lst.c main.c make.c parse.c proc.c shell.c str.c suff.c targ.c \ + util.c var.c + + +CFLAGS+=-DMAKE_VERSION=\"5200408120\" +# There is no obvious performance improvement currently. +# CFLAGS+=-DUSE_KQUEUE + +OBJS= $(SRCS:.c=.o) + +$(PROG): $(OBJS) + cc $(LDFLAGS) $(OBJS) -o $(PROG) + +\%.o:%.c + gcc $(CFLAGS) -c $< -o $@ + +clean: + rm $(OBJS) $(PROG).exe + +# Make object files which depend on preprocessor symbols defined in +# the Makefile which are not compilation options but rather configuration +# options dependend on the Makefile. main.c needs MAKE_VERSION while +# shell.c uses DEFSHELLNAME. This will cause recompilation in the case +# the definition is changed in the makefile. It will of course not cause +# recompilation if one does 'make MAKE_SHELL=csh'. +main.o shell.o: ${MAKEFILE} + +# Directive and keyword tables. We use hash tables. These hash tables have been +# generated with mph (ports/devel/mph) +# If you change the directives or keywords (adding, deleting, reordering) you +# need to create new tables and hash functions (directive_hash, keyword_hash). +# +# The following changes have been made to the generated code: +# +# o prefix the names of the g, T0 and T1 arrays with 'directive_' +# resp. 'keyword_'. +# +# o make the type of the tables 'const [un]signed char' (if you change +# anything make sure that the numbers fit into a char). +# +# o make the hash function use the length for termination, +# not the trailing '\0', via the -l flag in emitc and some editing +# (only for directive_hash). + +LOCALBASE ?= /usr/local +MPH ?= ${LOCALBASE}/bin/mph +EMITC ?= ${LOCALBASE}/bin/emitc + +.PRECIOUS: hash + +hash: + ( echo '/*' ; \ + echo ' * DO NOT EDIT' ; \ + echo ' * $$''FreeBSD$$' ; \ + echo -n ' * auto-generated from ' ; \ + sed -nEe '/\$$FreeBSD/s/^.*\$$(.*)\$$.*$$/\1/p' \ + ${.CURDIR}/parse.c ; \ + echo ' * DO NOT EDIT' ; \ + echo ' */' ; \ + echo '#include ' ; \ + echo ; \ + echo '#include "hash_tables.h"' ; \ + echo ; \ + cat ${.CURDIR}/parse.c | sed \ + -e '1,/DIRECTIVES-START-TAG/d' \ + -e '/DIRECTIVES-END-TAG/,$$d' \ + -e 's/^[^"]*"\([^"]*\)".*$$/\1/' | \ + ${MPH} -d2 -m1 | ${EMITC} -l -s | \ + sed \ + -e 's/^static int g\[\]/static const signed char directive_g[]/' \ + -e 's/^static int T0\[\]/static const u_char directive_T0[]/' \ + -e 's/^static int T1\[\]/static const u_char directive_T1[]/' \ + -e '/^#define uchar unsigned char/d' \ + -e 's/uchar/u_char/g' \ + -e 's/^hash(/directive_hash(/' \ + -e 's/; \*kp;/; kp < key + len;/' \ + -e 's/int len)/size_t len)/' \ + -e 's/= T0\[/= directive_T0\[/' \ + -e 's/= T1\[/= directive_T1\[/' \ + -e 's/g\[f/directive_g[f/g' ; \ + cat ${.CURDIR}/parse.c | sed \ + -e '1,/KEYWORD-START-TAG/d' \ + -e '/KEYWORD-END-TAG/,$$d' \ + -e 's/^[^"]*"\([^"]*\)".*$$/\1/' | \ + ${MPH} -d2 -m1 | ${EMITC} -l -s | \ + sed \ + -e 's/^static int g\[\]/static const signed char keyword_g[]/' \ + -e 's/^static int T0\[\]/static const u_char keyword_T0[]/' \ + -e 's/^static int T1\[\]/static const u_char keyword_T1[]/' \ + -e '/^#define uchar unsigned char/d' \ + -e 's/uchar/u_char/g' \ + -e 's/^hash(/keyword_hash(/' \ + -e 's/int len)/size_t len)/' \ + -e 's/= T0\[/= keyword_T0\[/' \ + -e 's/= T1\[/= keyword_T1\[/' \ + -e 's/g\[f/keyword_g[f/g' \ + ) > ${.CURDIR}/hash_tables.c + +# Set the shell which make(1) uses. Bourne is the default, but a decent +# Korn shell works fine, and much faster. Using the C shell for this +# will almost certainly break everything, but it's Unix tradition to +# allow you to shoot yourself in the foot if you want to :-) + +MAKE_SHELL?= sh +CFLAGS+= -DDEFSHELLNAME=\"${MAKE_SHELL}\" + +get_svn_copy: + svn co http://svn.freebsd.org/base/stable/7/usr.bin/make/ make Common subdirectories: make.org/PSD.doc and make/PSD.doc diff -N -u make.org/arch.c make/arch.c --- make.org/arch.c 2008-08-06 16:38:02.412605400 +0400 +++ make/arch.c 2008-08-06 15:12:53.669311500 +0400 @@ -38,6 +38,7 @@ * @(#)arch.c 8.2 (Berkeley) 1/2/94 */ +#include "my_cdefs.h" #include __FBSDID("$FreeBSD$"); diff -N -u make.org/buf.c make/buf.c --- make.org/buf.c 2008-08-06 16:38:02.397004600 +0400 +++ make/buf.c 2008-08-06 15:13:06.290358700 +0400 @@ -40,6 +40,7 @@ * @(#)buf.c 8.1 (Berkeley) 6/6/93 */ +#include "my_cdefs.h" #include __FBSDID("$FreeBSD$"); diff -N -u make.org/cond.c make/cond.c --- make.org/cond.c 2008-08-06 16:38:02.272198200 +0400 +++ make/cond.c 2008-08-06 15:13:19.005010700 +0400 @@ -39,6 +39,7 @@ * @(#)cond.c 8.2 (Berkeley) 1/2/94 */ +#include "my_cdefs.h" #include __FBSDID("$FreeBSD$"); diff -N -u make.org/dir.c make/dir.c --- make.org/dir.c 2008-08-06 16:38:02.428206200 +0400 +++ make/dir.c 2008-08-06 15:13:32.780517100 +0400 @@ -39,6 +39,7 @@ * @(#)dir.c 8.2 (Berkeley) 1/2/94 */ +#include "my_cdefs.h" #include __FBSDID("$FreeBSD$"); diff -N -u make.org/for.c make/for.c --- make.org/for.c 2008-08-06 16:38:02.599815000 +0400 +++ make/for.c 2008-08-06 15:13:41.984989100 +0400 @@ -32,6 +32,7 @@ * @(#)for.c 8.1 (Berkeley) 6/6/93 */ +#include "my_cdefs.h" #include __FBSDID("$FreeBSD$"); diff -N -u make.org/hash.c make/hash.c --- make.org/hash.c 2008-08-06 16:38:02.272198200 +0400 +++ make/hash.c 2008-08-06 15:13:52.874347500 +0400 @@ -39,6 +39,7 @@ * @(#)hash.c 8.1 (Berkeley) 6/6/93 */ +#include "my_cdefs.h" #include __FBSDID("$FreeBSD$"); diff -N -u make.org/job.c make/job.c --- make.org/job.c 2008-08-06 16:38:02.365803000 +0400 +++ make/job.c 2008-08-06 15:47:49.967128500 +0400 @@ -39,6 +39,7 @@ * @(#)job.c 8.2 (Berkeley) 3/19/94 */ +#include "my_cdefs.h" #include __FBSDID("$FreeBSD$"); @@ -411,7 +412,11 @@ * them with random characters until there are no more 'X'. */ while (ptr >= template && *ptr == 'X') { +#ifndef __CYGWIN__ uint32_t rand_num = arc4random() % (sizeof(padchar) - 1); +#else + uint32_t rand_num = lrand48() % (sizeof(padchar) - 1); +#endif *ptr-- = padchar[rand_num]; } start = ptr + 1; diff -N -u make.org/main.c make/main.c --- make.org/main.c 2008-08-06 16:38:02.506210200 +0400 +++ make/main.c 2008-08-06 15:51:21.031351800 +0400 @@ -45,9 +45,11 @@ The Regents of the University of California. All rights reserved.\n"; #endif #endif /* not lint */ +#include "my_cdefs.h" #include __FBSDID("$FreeBSD$"); + /* * main.c * The main file for this entire program. Exit routines etc @@ -63,7 +65,9 @@ #include #include +#ifndef __CYGWIN__ #include +#endif #include #include #include @@ -661,11 +665,21 @@ int level = (value == NULL) ? 0 : atoi(value); if (level < 0) { +#ifndef __CYGWIN__ errc(2, EAGAIN, "Invalid value for recursion level (%d).", level); +#else + err(2, "EAGAIN: Invalid value for recursion level (%d).", + level); +#endif } else if (level > MKLVL_MAXVAL) { +#ifndef __CYGWIN__ errc(2, EAGAIN, "Max recursion level (%d) exceeded.", MKLVL_MAXVAL); +#else + err(2, "EAGAIN: Max recursion level (%d) exceeded.", + MKLVL_MAXVAL); +#endif } else { char new_value[32]; sprintf(new_value, "%d", level + 1); @@ -947,10 +961,12 @@ size_t len; len = sizeof(ispc98); +#ifndef __CYGWIN__ if (!sysctlbyname("machdep.ispc98", &ispc98, &len, NULL, 0)) { if (ispc98) machine = "pc98"; } +#endif } /* diff -N -u make.org/make.c make/make.c --- make.org/make.c 2008-08-06 16:38:02.412605400 +0400 +++ make/make.c 2008-08-06 15:14:15.199092300 +0400 @@ -38,6 +38,7 @@ * @(#)make.c 8.1 (Berkeley) 6/6/93 */ +#include "my_cdefs.h" #include __FBSDID("$FreeBSD$"); diff -N -u make.org/my_cdefs.h make/my_cdefs.h --- make.org/my_cdefs.h 1970-01-01 03:00:00.000000000 +0300 +++ make/my_cdefs.h 2008-08-06 16:43:12.729118300 +0400 @@ -0,0 +1,8 @@ +/* + Shortcut or necessary defines so stuff works 'mostly' out of the repository + */ + +#define __unused __attribute__((__unused__)) +#define __FBSDID(s) static const char __FBSDID[] __unused = s + +#define __dead2 __attribute__((__noreturn__)) diff -N -u make.org/parse.c make/parse.c --- make.org/parse.c 2008-08-06 16:38:02.381403800 +0400 +++ make/parse.c 2008-08-06 15:14:25.682829900 +0400 @@ -38,6 +38,7 @@ * @(#)parse.c 8.3 (Berkeley) 3/19/94 */ +#include "my_cdefs.h" #include __FBSDID("$FreeBSD$"); diff -N -u make.org/proc.c make/proc.c --- make.org/proc.c 2008-08-06 16:38:02.334601400 +0400 +++ make/proc.c 2008-08-06 15:14:33.842048300 +0400 @@ -24,6 +24,7 @@ * SUCH DAMAGE. */ +#include "my_cdefs.h" #include __FBSDID("$FreeBSD$"); diff -N -u make.org/shell.c make/shell.c --- make.org/shell.c 2008-08-06 16:38:02.334601400 +0400 +++ make/shell.c 2008-08-06 15:16:17.010138700 +0400 @@ -37,6 +37,7 @@ * SUCH DAMAGE. */ +#include "my_cdefs.h" #include __FBSDID("$FreeBSD$"); diff -N -u make.org/str.c make/str.c --- make.org/str.c 2008-08-06 16:38:02.350202200 +0400 +++ make/str.c 2008-08-06 15:16:24.779337100 +0400 @@ -38,6 +38,7 @@ * @(#)str.c 5.8 (Berkeley) 6/1/90 */ +#include "my_cdefs.h" #include __FBSDID("$FreeBSD$"); diff -N -u make.org/suff.c make/suff.c --- make.org/suff.c 2008-08-06 16:38:02.319000600 +0400 +++ make/suff.c 2008-08-06 15:16:33.453381900 +0400 @@ -38,6 +38,7 @@ * @(#)suff.c 8.4 (Berkeley) 3/21/94 */ +#include "my_cdefs.h" #include __FBSDID("$FreeBSD$"); diff -N -u make.org/targ.c make/targ.c --- make.org/targ.c 2008-08-06 16:38:02.818226200 +0400 +++ make/targ.c 2008-08-06 15:16:42.377039500 +0400 @@ -38,6 +38,7 @@ * @(#)targ.c 8.2 (Berkeley) 3/19/94 */ +#include "my_cdefs.h" #include __FBSDID("$FreeBSD$"); diff -N -u make.org/util.c make/util.c --- make.org/util.c 2008-08-06 16:38:02.256597400 +0400 +++ make/util.c 2008-08-06 15:16:50.427052300 +0400 @@ -39,6 +39,7 @@ * @(#)main.c 8.3 (Berkeley) 3/19/94 */ +#include "my_cdefs.h" #include __FBSDID("$FreeBSD$"); diff -N -u make.org/util.h make/util.h --- make.org/util.h 2008-08-06 16:38:02.272198200 +0400 +++ make/util.h 2008-08-06 15:16:13.983583500 +0400 @@ -41,6 +41,7 @@ #ifndef util_h_b7020fdb #define util_h_b7020fdb +#include "my_cdefs.h" #include #include diff -N -u make.org/var.c make/var.c --- make.org/var.c 2008-08-06 16:38:02.802625400 +0400 +++ make/var.c 2008-08-06 15:17:14.312877200 +0400 @@ -39,6 +39,7 @@ * @(#)var.c 8.3 (Berkeley) 3/19/94 */ +#include "my_cdefs.h" #include __FBSDID("$FreeBSD$");