diff options
author | Jakob Kaivo <jkk@ung.org> | 2024-01-30 22:21:50 -0500 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2024-01-30 22:21:50 -0500 |
commit | 23a64baa02a9f45ae318b45f9f5f6f7cae1eb67c (patch) | |
tree | d599028dbe7db84093cff4f794c58ee8a08cdc24 | |
parent | 2c7f07a77c02a1bf7293bc4cc80254b972f747f8 (diff) |
update build to remove the configure step
-rw-r--r-- | Makefile | 95 | ||||
-rw-r--r-- | README.md | 37 |
2 files changed, 127 insertions, 5 deletions
@@ -1,6 +1,6 @@ .POSIX: -include .config.mk +#include .config.mk AR=ar ARFLAGS=rU @@ -8,6 +8,16 @@ BASE_CFLAGS=-g -O0 -Wall -Wextra -Werror -nostdinc -fno-builtin -fno-stack-prote OBJDIR=obj SRCDIR=src +## Previously in .configure.mk +ARCHITECTURE=x86 +WORDSIZE=64 +TOPDIR=. +SRCDIR=$(TOPDIR)/src +INCDIR=/lib/include +OBJDIR=./obj + +include mk/configured.mk + all: libung.so include mk/all.mk @@ -20,10 +30,93 @@ newdeps: cleandeps printf '.POSIX:\n\nall:\n\n' > mk/deps.mk for i in $$(find src -name \*.c); do sh mk/deps.sh $$i; done for i in $$(find src -name \*.$(ARCHITECTURE)-$(WORDSIZE).s); do sh mk/deps.sh $$i; done + touch mk/configured.mk libung.so: libc.a libm.a $(CC) -o libung.so -shared obj/*.o +c89 c90: + printf '.POSIX:\n\n' > mk/configured.mk + printf 'CC=c89\n' >> mk/configured.mk + printf 'CFLAGS=$$(BASE_CFLAGS) $(CFLAGS)\n' >> mk/configured.mk + printf 'all: libc_C.0\n' >> mk/configured.mk + printf 'all: libc_C.1\n' >> mk/configured.mk + printf 'all: libm_C.0\n' >> mk/configured.mk + printf 'all: libm_C.1\n' >> mk/configured.mk + $(MAKE) + +# 199409 +c94 c95 amd1: + printf '.POSIX:\n\n' > mk/configured.mk + printf 'CC=c89\n' >> mk/configured.mk + printf 'CFLAGS=-std=c94 $$(BASE_CFLAGS) $(CFLAGS)\n' >> mk/configured.mk + printf 'all: libc_C.0\n' >> mk/configured.mk + printf 'all: libc_C.1\n' >> mk/configured.mk + printf 'all: libc_C.199409\n' >> mk/configured.mk + printf 'all: libm_C.0\n' >> mk/configured.mk + printf 'all: libm_C.1\n' >> mk/configured.mk + $(MAKE) + + +# 199901 +c99: + printf '.POSIX:\n\n' > mk/configured.mk + printf 'CC=c99\n' >> mk/configured.mk + printf 'CFLAGS=$$(BASE_CFLAGS) $(CFLAGS)\n' >> mk/configured.mk + printf 'all: libc_C.0\n' >> mk/configured.mk + printf 'all: libc_C.1\n' >> mk/configured.mk + printf 'all: libc_C.199409\n' >> mk/configured.mk + printf 'all: libc_C.199901\n' >> mk/configured.mk + printf 'all: libm_C.0\n' >> mk/configured.mk + printf 'all: libm_C.1\n' >> mk/configured.mk + printf 'all: libm_C.199901\n' >> mk/configured.mk + $(MAKE) + +# 201112 +c11: +c11+ext1: c11 + +# 201710 +c17 c18: +c17+ext1 c18+ext1: c18 + +# _POSIX_SOURCE +posix-1: c89 + +posix-1+amd1 posix-1+c94 posix-1+c95: c94 + +# _POSIX_C_SOURCE 2 +posix-2: c89 +posix-1+amd1 posix-1+c94 posix-1+c95: c94 + +# _POSIX_C_SOURCE 199309 +posix-1993: c89 +posix-1+amd1 posix-1+c94 posix-1+c95: c94 + +# _POSIX_C_SOURCE 199506 +posix-1995: c94 + +# _POSIX_C_SOURCE 200112 +posix-2001: c99 + +# _POSIX_C_SOURCE 200809 +posix-2008: c99 + +# _XOPEN_SOURCE < 500 # TODO: +amd1 +xopen-4 xpg-4: posix-1993 + +# _XOPEN_EXTENDED_UNIX # TODO: +amd1 +susv1 xopen-4-extended xpg-4-extended: xopen-4 + +# _XOPEN_SOURCE 500 +susv2 xopen-500 xpg-5: posix-1995 + +# _XOPEN_SOURCE 600 +susv3 xopen-600 xpg-6: posix-2001 + +# _XOPEN_SOURCE 700 # TODO: +c11/c18(+ext1) +susv4 xopen-700 xpg-7: posix-2008 + deps: $(MAKE) -f mk/deps.mk @@ -1,10 +1,39 @@ Building -------- -First run `configure` to set up the standards conformance. It has help when run -with -h, which will always be more up-to-date than anything that could be put -in this document. +First, determine what level of library support you want. If you only need +ISO C support, you'll want one of the following targets: -Then run `make`. +* c89 - ISO/IEC 9899:1990, AKA ANSI X3.159-1989, ANSI C, ISO C, C89, C90 +* c94 - ISO/IEC 9899:1990/AMD1:1995, AKA C94, C95 +* c99 - ISO/IEC 9899:1999, AKA C99 +* c11 - ISO/IEC 9899:2011, AKA C11 +* c11+ext1 - ISO/IEC 9899:2011, AKA C11, with Extension 1 +* c18 - ISO/IEC 9899:2018, AKA C18 +* c18+ext1 - ISO/IEC 9899:2018, AKA C18, with Extension 1 + +For basic POSIX support: + +* posix-1 - POSIX.1-1990 (includes POSIX.1-1988, implies C89) +* posix-2 - POSIX.1-1990 plus POSIX.2-1992 +* posix-1993 - POSIX.1b-1993 (includes POSIX.1-1990) +* posix-1995 - POSIX.1-1996 +* posix-2001 - POSIX.1-2001 (implies C99) +* posix-2008 - POSIX.1-2008 (implies C99) + +For complete Single UNIX Specification (X/Open) support: + +* susv1 - Single Unix Specification, version 1 (includes POSIX.1-1990 and POSIX.2-1992) +* susv2 - Single Unix Specification, version 2 (includes POSIX.1-1995) +* susv3 - Single Unix Specification, version 3 (includes POSIX.1-2001) +* susv4 - Single Unix Specification, version 4 (includes POSIX.1-2008) + +Then run `make` followed by your preferred target. For example, to get a full +SUSv4 library, run: + + make susv4 + +If you run `make` without any targets, it will default to the most recently +selected target. The default target straight from git is `c18+ext1`. Code Organization ----------------- |