summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2019-02-01 21:08:08 -0500
committerJakob Kaivo <jkk@ung.org>2019-02-01 21:08:08 -0500
commitb01e4f9de7ab1a9adfb86395276f244361d0a953 (patch)
tree63c26604043b733b3b73f62d79179e8846f27f27
parentfefdd28108f8354a72bd564aefb76f8d0fbee016 (diff)
build full POSIX.1-1990 and 9899-1990-AMD1 from extra-clean
-rw-r--r--.cc.mk1
-rw-r--r--.cflags.mk9
-rw-r--r--.deps.mk11
-rw-r--r--.headers.mk22
-rw-r--r--config.mk2
-rwxr-xr-xmkmf.sh13
6 files changed, 45 insertions, 13 deletions
diff --git a/.cc.mk b/.cc.mk
new file mode 100644
index 00000000..dfdc1fbd
--- /dev/null
+++ b/.cc.mk
@@ -0,0 +1 @@
+CC=gcc -std=iso9899:199409
diff --git a/.cflags.mk b/.cflags.mk
new file mode 100644
index 00000000..8c8c32e3
--- /dev/null
+++ b/.cflags.mk
@@ -0,0 +1,9 @@
+CFLAGS=-D_POSIX_SOURCE
+STDCFLAGS=
+STDCFLAGS=-D_POSIX_SOURCE
+STDCFLAGS=-D_POSIX_SOURCE
+STDCFLAGS=-D_POSIX_SOURCE
+STD_CFLAGS=
+STD_CFLAGS=-D_POSIX_SOURCE
+STD_CFLAGS=-D_POSIX_SOURCE
+STD_CFLAGS=-D_POSIX_SOURCE
diff --git a/.deps.mk b/.deps.mk
index 44ee3c28..8724635b 100644
--- a/.deps.mk
+++ b/.deps.mk
@@ -2,10 +2,12 @@
default: all
+include .cc.mk
+include .cflags.mk
include config.mk
INCLUDES=-I$(INCDIR) -I. -Inonstd/stubs
-CFLAGS=$(INCLUDES) -g -fno-builtin -nostdinc -nostdlib -nodefaultlibs -Werror -Wall -Wextra -fPIC
+CFLAGS=$(INCLUDES) $(STD_CFLAGS) -g -fno-builtin -nostdinc -nostdlib -nodefaultlibs -Werror -Wall -Wextra -fPIC
libc_OBJS = $(OBJDIR)/libc.o $(OBJDIR)/x86-64.o \
$(OBJDIR)/isalnum.o \
@@ -241,7 +243,6 @@ libc_OBJS = $(OBJDIR)/libc.o $(OBJDIR)/x86-64.o \
$(OBJDIR)/putwchar.o \
$(OBJDIR)/swprintf.o \
$(OBJDIR)/swscanf.o \
- $(OBJDIR)/tm.o \
$(OBJDIR)/ungetwc.o \
$(OBJDIR)/vfwprintf.o \
$(OBJDIR)/vswprintf.o \
@@ -1312,10 +1313,6 @@ $(OBJDIR)/times.o: src/POSIX.1-1988/sys/times/times.c $(INCDIR)/sys/times.h
-@mkdir -p $(OBJDIR)
$(CC) $(CFLAGS) -c src/POSIX.1-1988/sys/times/times.c -o $@
-$(OBJDIR)/tm.o: src/9899-1990-AMD1/wchar/tm.c $(INCDIR)/wchar.h
- -@mkdir -p $(OBJDIR)
- $(CC) $(CFLAGS) -c src/9899-1990-AMD1/wchar/tm.c -o $@
-
$(OBJDIR)/tmpfile.o: src/9899-1990/stdio/tmpfile.c $(INCDIR)/stdio.h
-@mkdir -p $(OBJDIR)
$(CC) $(CFLAGS) -c src/9899-1990/stdio/tmpfile.c -o $@
@@ -1396,7 +1393,7 @@ $(OBJDIR)/vsprintf.o: src/9899-1990/stdio/vsprintf.c $(INCDIR)/stdio.h
-@mkdir -p $(OBJDIR)
$(CC) $(CFLAGS) -c src/9899-1990/stdio/vsprintf.c -o $@
-$(OBJDIR)/vswprintf.o: src/9899-1990-AMD1/wchar/vswprintf.c $(INCDIR)/stdarg.h
+$(OBJDIR)/vswprintf.o: src/9899-1990-AMD1/wchar/vswprintf.c $(INCDIR)/wchar.h
-@mkdir -p $(OBJDIR)
$(CC) $(CFLAGS) -c src/9899-1990-AMD1/wchar/vswprintf.c -o $@
diff --git a/.headers.mk b/.headers.mk
index bb681b42..01dcf50e 100644
--- a/.headers.mk
+++ b/.headers.mk
@@ -358,8 +358,7 @@ stdarg_h_SOURCES = \
src/9899-1990/stdarg/va_arg.c \
src/9899-1990/stdarg/va_end.c \
src/9899-1990/stdarg/va_list.c \
- src/9899-1990/stdarg/va_start.c \
- src/9899-1990-AMD1/wchar/vswprintf.c
+ src/9899-1990/stdarg/va_start.c
$(INCDIR)/stdarg.h: $(stdarg_h_SOURCES)
sh mkh.sh $@ $(stdarg_h_SOURCES)
@@ -851,11 +850,12 @@ wchar_h_SOURCES = \
src/9899-1990-AMD1/wchar/mbstate_t.c \
src/9899-1990-AMD1/wchar/putwc.c \
src/9899-1990-AMD1/wchar/putwchar.c \
+ src/9899-1990-AMD1/wchar/struct_tm.c \
src/9899-1990-AMD1/wchar/swprintf.c \
src/9899-1990-AMD1/wchar/swscanf.c \
- src/9899-1990-AMD1/wchar/tm.c \
src/9899-1990-AMD1/wchar/ungetwc.c \
src/9899-1990-AMD1/wchar/vfwprintf.c \
+ src/9899-1990-AMD1/wchar/vswprintf.c \
src/9899-1990-AMD1/wchar/vwprintf.c \
src/9899-1990-AMD1/wchar/wcrtomb.c \
src/9899-1990-AMD1/wchar/wcscat.c \
@@ -886,7 +886,21 @@ wchar_h_SOURCES = \
src/9899-1990-AMD1/wchar/wmemmove.c \
src/9899-1990-AMD1/wchar/wmemset.c \
src/9899-1990-AMD1/wchar/wprintf.c \
- src/9899-1990-AMD1/wchar/wscanf.c
+ src/9899-1990-AMD1/wchar/wscanf.c \
+ src/9899-1990-AMD1/wchar/FILE.ref \
+ src/9899-1990/stdio/FILE.c \
+ src/9899-1990-AMD1/wchar/NULL.ref \
+ src/9899-1990/stddef/NULL.c \
+ src/9899-1990-AMD1/wchar/WEOF.ref \
+ src/9899-1990-AMD1/wctype/WEOF.c \
+ src/9899-1990-AMD1/wchar/size_t.ref \
+ src/9899-1990/stddef/size_t.c \
+ src/9899-1990-AMD1/wchar/va_list.ref \
+ src/9899-1990/stdarg/va_list.c \
+ src/9899-1990-AMD1/wchar/wchar_t.ref \
+ src/9899-1990/stddef/wchar_t.c \
+ src/9899-1990-AMD1/wchar/wint_t.ref \
+ src/9899-1990-AMD1/wctype/wint_t.c
$(INCDIR)/wchar.h: $(wchar_h_SOURCES)
sh mkh.sh $@ $(wchar_h_SOURCES)
diff --git a/config.mk b/config.mk
index 49a6712c..43a7e77e 100644
--- a/config.mk
+++ b/config.mk
@@ -1,6 +1,6 @@
.POSIX:
-CC=c89
OBJDIR=obj
INCDIR=include
+
STANDARD=P90+AMD1
diff --git a/mkmf.sh b/mkmf.sh
index 1fc9eb9a..7904d7b4 100755
--- a/mkmf.sh
+++ b/mkmf.sh
@@ -19,6 +19,15 @@ if [ -f src/${STANDARD}/DEPS.mk ]; then
for i in $(grep DEPS src/${STANDARD}/DEPS.mk | cut -d= -f2); do
sh $0 $i
done
+
+ if grep -q 'CC' src/${STANDARD}/DEPS.mk; then
+ grep 'CC' src/${STANDARD}/DEPS.mk > .cc.mk
+ fi
+
+ if grep -q 'CFLAGS' src/${STANDARD}/DEPS.mk; then
+ #grep 'CFLAGS' src/${STANDARD}/DEPS.mk > .cflags.mk
+ grep 'CFLAGS' src/${STANDARD}/DEPS.mk | sed -e 's/CFLAGS/STD_CFLAGS/' >> .cflags.mk
+ fi
fi
rm -f .dep/${STANDARD}.*
@@ -71,9 +80,11 @@ done
if [ $(cat .dep/to-build) = ${STANDARD} ]; then
printf '.POSIX:\n\n' > .deps.mk
printf 'default: all\n\n' >> .deps.mk
+ printf 'include .cc.mk\n' >> .deps.mk
+ printf 'include .cflags.mk\n' >> .deps.mk
printf 'include config.mk\n\n' >> .deps.mk
printf 'INCLUDES=-I$(INCDIR) -I. -Inonstd/stubs\n' >> .deps.mk
- printf 'CFLAGS=$(INCLUDES) -g -fno-builtin -nostdinc -nostdlib -nodefaultlibs -Werror -Wall -Wextra -fPIC\n\n' >> .deps.mk
+ printf 'CFLAGS=$(INCLUDES) $(STD_CFLAGS) -g -fno-builtin -nostdinc -nostdlib -nodefaultlibs -Werror -Wall -Wextra -fPIC\n\n' >> .deps.mk
for i in .dep/lib*.a.mk; do
LIB=$(basename $i .a.mk)