From b0c238eb5d6d403b675171a70833584c1ba5c0ce Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 12 May 2013 23:51:55 +0100 Subject: [PATCH] Made a start on building the runtimes for each platform and language; the Linuxes all build. --HG-- branch : dtrg-buildsystem rename : modules/src/em_mes/build.mk => modules/src/read_em/build.mk rename : plat/pc86/build.mk => plat/linux386/build.mk rename : plat/pc86/build.mk => plat/linux68k/build.mk rename : plat/pc86/build.mk => plat/linuxppc/build.mk rename : util/ack/build.mk => util/misc/build.mk --- Makefile | 7 ++ first/core.mk | 7 +- lang/cem/libcc.ansi/build.mk | 226 +++++++++++++++++++++++++++++++++++ mach/m68020/as/mach0.c | 2 +- mach/proto/as/build.mk | 2 +- mach/proto/ncg/build.mk | 4 +- modules/src/em_code/build.mk | 2 +- modules/src/read_em/build.mk | 54 +++++++++ plat/build.mk | 11 +- plat/cpm/build.mk | 28 ++++- plat/cpm/libsys/build.mk | 28 ----- plat/linux/liblinux/build.mk | 27 +++++ plat/linux386/build.mk | 17 +++ plat/linux386/descr | 10 +- plat/linux68k/build.mk | 18 +++ plat/linux68k/descr | 10 +- plat/linuxppc/build.mk | 19 +++ plat/linuxppc/descr | 12 +- plat/pc86/build.mk | 25 +++- plat/pc86/libsys/build.mk | 26 ---- util/cmisc/build.mk | 7 +- util/data/build.mk | 3 +- util/misc/build.mk | 48 ++++++++ 23 files changed, 501 insertions(+), 92 deletions(-) create mode 100644 modules/src/read_em/build.mk delete mode 100644 plat/cpm/libsys/build.mk create mode 100644 plat/linux/liblinux/build.mk create mode 100644 plat/linux386/build.mk create mode 100644 plat/linux68k/build.mk create mode 100644 plat/linuxppc/build.mk delete mode 100644 plat/pc86/libsys/build.mk create mode 100644 util/misc/build.mk diff --git a/Makefile b/Makefile index 7c6371dfc..b121d3e28 100644 --- a/Makefile +++ b/Makefile @@ -39,6 +39,7 @@ include modules/src/print/build.mk include modules/src/flt_arith/build.mk include modules/src/em_code/build.mk include modules/src/em_mes/build.mk +include modules/src/read_em/build.mk include util/amisc/build.mk include util/cmisc/build.mk @@ -48,15 +49,21 @@ include util/data/build.mk include util/opt/build.mk include util/ncgg/build.mk include util/arch/build.mk +include util/misc/build.mk include lang/cem/build.mk include mach/proto/as/build.mk include mach/proto/ncg/build.mk +include plat/linux/liblinux/build.mk + include plat/build.mk include plat/pc86/build.mk include plat/cpm/build.mk +include plat/linux386/build.mk +include plat/linux68k/build.mk +include plat/linuxppc/build.mk .PHONY: installables installables: $(INSTALLABLES) diff --git a/first/core.mk b/first/core.mk index 898cf0d03..09b51a925 100644 --- a/first/core.mk +++ b/first/core.mk @@ -34,7 +34,8 @@ $o: $s $(ACK) \ $(PLATIND)/descr/$(PLATFORM) \ $(PLATDEP)/$(PLATFORM)/as \ $(CCOMPILER) \ - $(PLATFORM_$(PLATFORM)) + $(PLATFORM_$(PLATFORM)) \ + $(EM_ENCODE) @echo ACK $o @mkdir -p $(dir $o) $(hide) ACKDIR=$(INSDIR) $(ACK) $(ACKFLAGS) $(ackflags) -m$(PLATFORM) -c -o $o $s @@ -42,8 +43,8 @@ endef define ackfile $(eval s := $1) - $(eval o := $(OBJDIR)/$(basename $1).o) - $(eval d := $(OBJDIR)/$(basename $1).d) + $(eval o := $(OBJDIR)/$(objdir)/$(basename $1).o) + $(eval d := $(OBJDIR)/$(objdir)/$(basename $1).d) $(eval DEPENDS += $d) $(eval CLEANABLES += $o $d) $(eval q += $o) diff --git a/lang/cem/libcc.ansi/build.mk b/lang/cem/libcc.ansi/build.mk index 640f7f344..727d04718 100644 --- a/lang/cem/libcc.ansi/build.mk +++ b/lang/cem/libcc.ansi/build.mk @@ -12,6 +12,7 @@ define build-libcc-ansi-headers-impl assert.h \ ctype.h \ errno.h \ + fcntl.h \ float.h \ limits.h \ math.h \ @@ -34,3 +35,228 @@ define build-libcc-ansi-headers-impl endef $(eval $(build-libcc-ansi-headers-impl)) + +define build-runtime-libcc-ansi-impl + +$(call reset) +$(eval objdir := $(PLATFORM)) + +# Assert + +$(call ackfile, lang/cem/libcc.ansi/assert/assert.c) + +# CType + +$(call ackfile, lang/cem/libcc.ansi/ctype/tolower.c) +$(call ackfile, lang/cem/libcc.ansi/ctype/toupper.c) +$(call acktabgen, lang/cem/libcc.ansi/ctype/char.tab) + +$(eval g := \ + isalnum.c \ + isalpha.c \ + iscntrl.c \ + isdigit.c \ + isgraph.c \ + islower.c \ + isprint.c \ + ispunct.c \ + isspace.c \ + isupper.c \ + isxdigit.c \ + isascii.c) +$(eval g := $(addprefix $(OBJDIR)/$(objdir)/ctype/, $g)) + +$(wordlist 2, $(words $g), $g): $(firstword $g) +$(firstword $g): lang/cem/libcc.ansi/ctype/genfiles + @echo GENFILES $$@ + @mkdir -p $$(dir $$@) + $(hide) cd $$(dir $$@) && sh $$(abspath $$^) + +$(eval CLEANABLES += $g) +$(foreach f, $g, $(call ackfile, $f)) + +# errno + +$(call ackfile, lang/cem/libcc.ansi/errno/errlist.c) + +# locale + +$(call ackfile, lang/cem/libcc.ansi/locale/localeconv.c) +$(call ackfile, lang/cem/libcc.ansi/locale/setlocale.c) + +# math + +$(call ackfile, lang/cem/libcc.ansi/math/asin.c) +$(call ackfile, lang/cem/libcc.ansi/math/atan2.c) +$(call ackfile, lang/cem/libcc.ansi/math/atan.c) +$(call ackfile, lang/cem/libcc.ansi/math/ceil.c) +$(call ackfile, lang/cem/libcc.ansi/math/fabs.c) +$(call ackfile, lang/cem/libcc.ansi/math/pow.c) +$(call ackfile, lang/cem/libcc.ansi/math/log10.c) +$(call ackfile, lang/cem/libcc.ansi/math/log.c) +$(call ackfile, lang/cem/libcc.ansi/math/sin.c) +$(call ackfile, lang/cem/libcc.ansi/math/sinh.c) +$(call ackfile, lang/cem/libcc.ansi/math/sqrt.c) +$(call ackfile, lang/cem/libcc.ansi/math/tan.c) +$(call ackfile, lang/cem/libcc.ansi/math/tanh.c) +$(call ackfile, lang/cem/libcc.ansi/math/exp.c) +$(call ackfile, lang/cem/libcc.ansi/math/ldexp.c) +$(call ackfile, lang/cem/libcc.ansi/math/fmod.c) +$(call ackfile, lang/cem/libcc.ansi/math/floor.c) +$(call ackfile, lang/cem/libcc.ansi/math/hugeval.c) +$(call ackfile, lang/cem/libcc.ansi/math/frexp.e) +$(call ackfile, lang/cem/libcc.ansi/math/modf.e) +$(call ackfile, lang/cem/libcc.ansi/math/isnan.c) + +# Misc + +$(call ackfile, lang/cem/libcc.ansi/misc/environ.c) +# (lots of stuff missing here, as not being appropriate on modern systems) + +# setjmp + +$(call ackfile, lang/cem/libcc.ansi/setjmp/setjmp.e) + +# signal + +$(call ackfile, lang/cem/libcc.ansi/signal/raise.c) + +# stdio + +$(call ackfile, lang/cem/libcc.ansi/stdio/tmpfile.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/tmpnam.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/fopen.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/freopen.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/setbuf.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/setvbuf.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/perror.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/fprintf.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/printf.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/sprintf.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/vfprintf.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/vprintf.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/vsprintf.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/doprnt.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/icompute.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/fscanf.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/scanf.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/sscanf.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/doscan.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/fgetc.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/fgets.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/getc.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/getchar.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/gets.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/putc.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/putchar.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/fputc.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/puts.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/fputs.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/ungetc.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/fread.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/fwrite.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/fgetpos.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/fsetpos.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/rewind.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/fseek.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/ftell.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/clearerr.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/feof.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/ferror.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/fileno.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/fltpr.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/ecvt.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/fillbuf.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/fclose.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/flushbuf.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/fflush.c) +$(call ackfile, lang/cem/libcc.ansi/stdio/data.c) + +# stdlib + +$(call ackfile, lang/cem/libcc.ansi/stdlib/abort.c) +$(call ackfile, lang/cem/libcc.ansi/stdlib/abs.c) +$(call ackfile, lang/cem/libcc.ansi/stdlib/atof.c) +$(call ackfile, lang/cem/libcc.ansi/stdlib/atoi.c) +$(call ackfile, lang/cem/libcc.ansi/stdlib/atol.c) +$(call ackfile, lang/cem/libcc.ansi/stdlib/bsearch.c) +$(call ackfile, lang/cem/libcc.ansi/stdlib/div.c) +$(call ackfile, lang/cem/libcc.ansi/stdlib/atexit.c) +$(call ackfile, lang/cem/libcc.ansi/stdlib/exit.c) +$(call ackfile, lang/cem/libcc.ansi/stdlib/getenv.c) +$(call ackfile, lang/cem/libcc.ansi/stdlib/labs.c) +$(call ackfile, lang/cem/libcc.ansi/stdlib/ldiv.c) +$(call ackfile, lang/cem/libcc.ansi/stdlib/mblen.c) +$(call ackfile, lang/cem/libcc.ansi/stdlib/mbstowcs.c) +$(call ackfile, lang/cem/libcc.ansi/stdlib/mbtowc.c) +$(call ackfile, lang/cem/libcc.ansi/stdlib/qsort.c) +$(call ackfile, lang/cem/libcc.ansi/stdlib/rand.c) +$(call ackfile, lang/cem/libcc.ansi/stdlib/strtod.c) +$(call ackfile, lang/cem/libcc.ansi/stdlib/strtol.c) +$(call ackfile, lang/cem/libcc.ansi/stdlib/wcstombs.c) +$(call ackfile, lang/cem/libcc.ansi/stdlib/wctomb.c) +$(call ackfile, lang/cem/libcc.ansi/stdlib/ext_comp.c) + +$(eval g := $(OBJDIR)/$(objdir)/malloc.c) +$(eval CLEANABLES += $g) +$(eval srcs := \ + READ_ME size_type.h param.h impl.h check.h \ + log.h phys.h mal.c log.c phys.c check.c) +$(eval srcs := $(addprefix lang/cem/libcc.ansi/stdlib/malloc/, $(srcs))) + +$g: lang/cem/libcc.ansi/stdlib/malloc/add_file $(srcs) + @echo MALLOC $g + @mkdir -p $(dir $g) + $(hide) $(RM) $g && for i in $(srcs); do \ + lang/cem/libcc.ansi/stdlib/malloc/add_file $$$$i >> $g; done + +$(call ackfile, $g) + +# String + +$(call ackfile, lang/cem/libcc.ansi/string/memchr.c) +$(call ackfile, lang/cem/libcc.ansi/string/memcmp.c) +$(call ackfile, lang/cem/libcc.ansi/string/memcpy.c) +$(call ackfile, lang/cem/libcc.ansi/string/memmove.c) +$(call ackfile, lang/cem/libcc.ansi/string/memset.c) +$(call ackfile, lang/cem/libcc.ansi/string/strcat.c) +$(call ackfile, lang/cem/libcc.ansi/string/strchr.c) +$(call ackfile, lang/cem/libcc.ansi/string/strcmp.c) +$(call ackfile, lang/cem/libcc.ansi/string/strcoll.c) +$(call ackfile, lang/cem/libcc.ansi/string/strcpy.c) +$(call ackfile, lang/cem/libcc.ansi/string/strcspn.c) +$(call ackfile, lang/cem/libcc.ansi/string/strerror.c) +$(call ackfile, lang/cem/libcc.ansi/string/strncat.c) +$(call ackfile, lang/cem/libcc.ansi/string/strncpy.c) +$(call ackfile, lang/cem/libcc.ansi/string/strrchr.c) +$(call ackfile, lang/cem/libcc.ansi/string/strstr.c) +$(call ackfile, lang/cem/libcc.ansi/string/strlen.c) +$(call ackfile, lang/cem/libcc.ansi/string/strtok.c) +$(call ackfile, lang/cem/libcc.ansi/string/strpbrk.c) +$(call ackfile, lang/cem/libcc.ansi/string/strspn.c) +$(call ackfile, lang/cem/libcc.ansi/string/strncmp.c) +$(call ackfile, lang/cem/libcc.ansi/string/strxfrm.c) + +# Time + +$(call ackfile, lang/cem/libcc.ansi/time/ctime.c) +$(call ackfile, lang/cem/libcc.ansi/time/asctime.c) +$(call ackfile, lang/cem/libcc.ansi/time/localtime.c) +$(call ackfile, lang/cem/libcc.ansi/time/clock.c) +$(call ackfile, lang/cem/libcc.ansi/time/difftime.c) +$(call ackfile, lang/cem/libcc.ansi/time/gmtime.c) +$(call ackfile, lang/cem/libcc.ansi/time/mktime.c) +$(call ackfile, lang/cem/libcc.ansi/time/strftime.c) +$(call ackfile, lang/cem/libcc.ansi/time/time.c) +$(call ackfile, lang/cem/libcc.ansi/time/tzset.c) +$(call ackfile, lang/cem/libcc.ansi/time/misc.c) + +$(call acklibrary, $(LIBDIR)/$(PLATFORM)/libc.a) +$(call installto, $(PLATIND)/$(PLATFORM)/libc.a) + +endef + +build-runtime-libcc-ansi = $(eval $(build-runtime-libcc-ansi-impl)) + +$(eval RUNTIMES += libcc-ansi) + diff --git a/mach/m68020/as/mach0.c b/mach/m68020/as/mach0.c index 2884213be..498620c0e 100644 --- a/mach/m68020/as/mach0.c +++ b/mach/m68020/as/mach0.c @@ -10,7 +10,7 @@ #define THREE_PASS /* branch and offset optimization */ #define BYTES_REVERSED /* high order byte has lowest address */ #define WORDS_REVERSED /* high order word has lowest address */ -/*#define LISTING /* enable listing facilities */ +/*#define LISTING */ /* enable listing facilities */ #define RELOCATION /* generate relocatable code */ #define DEBUG 0 diff --git a/mach/proto/as/build.mk b/mach/proto/as/build.mk index d98fe7454..9404f13b9 100644 --- a/mach/proto/as/build.mk +++ b/mach/proto/as/build.mk @@ -2,7 +2,7 @@ define build-as-impl $(call reset) $(eval cflags += -Imach/$(ARCH)/as -I$(OBJDIR)/$D) - $(eval objdir := $D) + $(eval objdir := $(PLATFORM)) $(call cfile, mach/proto/as/comm3.c) $(call dependson, $(OBJDIR)/$D/y.tab.h) diff --git a/mach/proto/ncg/build.mk b/mach/proto/ncg/build.mk index e3843b7f3..100ece434 100644 --- a/mach/proto/ncg/build.mk +++ b/mach/proto/ncg/build.mk @@ -3,7 +3,7 @@ define build-ncg-impl $(call reset) $(eval cflags += -Imach/$(ARCH)/ncg -I$(OBJDIR)/$D -Imach/proto/ncg) -$(eval objdir := $D/ncg) +$(eval objdir := $(PLATFORM)) $(call cfile, mach/proto/ncg/codegen.c) $(call cfile, mach/proto/ncg/compute.c) @@ -29,7 +29,7 @@ $(OBJDIR)/$D/tables.h: $(NCGG) $(CPPANSI) mach/$(ARCH)/ncg/table @echo NCGG $$@ @mkdir -p $$(dir $$@) $(hide) cd $$(dir $$@) && \ - $(abspath $(CPPANSI)) $(abspath mach/$(ARCH)/ncg/table) | $(abspath $(NCGG)) + $(abspath $(CPPANSI)) -I$(abspath mach/$(ARCH)/ncg) $(abspath mach/$(ARCH)/ncg/table) | $(abspath $(NCGG)) $(hide) mv $(OBJDIR)/$D/tables.H $(OBJDIR)/$D/tables.h $(call cfile, $(OBJDIR)/$D/tables.c) diff --git a/modules/src/em_code/build.mk b/modules/src/em_code/build.mk index 8fcba3c7f..dbef43003 100644 --- a/modules/src/em_code/build.mk +++ b/modules/src/em_code/build.mk @@ -7,7 +7,7 @@ D := modules/src/em_code define build-em_code-impl $(call reset) $(eval cflags += $3) - $(eval objdir := $D/$1) + $(eval objdir := $1) $(call cfile, $D/bhcst.c) $(call cfile, $D/bhdlb.c) $(call cfile, $D/bhdnam.c) diff --git a/modules/src/read_em/build.mk b/modules/src/read_em/build.mk new file mode 100644 index 000000000..17606718c --- /dev/null +++ b/modules/src/read_em/build.mk @@ -0,0 +1,54 @@ +D := modules/src/read_em + +define build-read_em-headers-impl + +$(eval g := $(OBJDIR)/$D/C_mnem_narg.h) +$(eval CLEANABLES += $g) +$g: $D/m_C_mnem_na h/em_table + @echo M_C_MNEM_NA $g + @mkdir -p $(dir $g) + $(hide) cd $D && $(abspath $D/m_C_mnem_na) $(abspath h/em_table) > $(abspath $g) + +$(eval g := $(OBJDIR)/$D/C_mnem.h) +$(eval CLEANABLES += $g) +$g: $D/m_C_mnem h/em_table + @echo M_C_MNEM $g + @mkdir -p $(dir $g) + $(hide) cd $D && $(abspath $D/m_C_mnem) $(abspath h/em_table) > $(abspath $g) + +endef + +define build-read_em-impl + +$(call reset) +$(eval objdir := emev) +$(eval cflags += -I$(OBJDIR)/$D -DPRIVATE=static -DEXPORT= -DNDEBUG -DCHECKING) +$(call cfile, $D/EM_vars.c) +$(call cfile, $D/read_em.c) +$(call cfile, $D/mkcalls.c) +$(eval $q: $(OBJDIR)/$D/C_mnem_narg.h) +$(eval $q: $(OBJDIR)/$D/C_mnem.h) +$(call clibrary, $(LIBDIR)/lib_read_emeV.a) +$(eval LIBREAD_EMEV := $q) + +$(call reset) +$(eval objdir := emkv) +$(eval cflags += -I$(OBJDIR)/$D -DPRIVATE=static -DEXPORT= -DNDEBUG -DCHECKING -DCOMPACT) +$(call cfile, $D/EM_vars.c) +$(call cfile, $D/read_em.c) +$(call cfile, $D/mkcalls.c) +$(eval $q: $(OBJDIR)/$D/C_mnem_narg.h) +$(eval $q: $(OBJDIR)/$D/C_mnem.h) +$(call clibrary, $(LIBDIR)/lib_read_emkV.a) +$(eval LIBREAD_EMKV := $q) + +$(call reset) +$(eval q := $D/em_comp.h) +$(call installto, $(INCDIR)/em_comp.h) + +endef + +$(eval $(call build-read_em-headers-impl)) +$(eval $(call build-read_em-impl)) + + diff --git a/plat/build.mk b/plat/build.mk index dde75784c..e43b02614 100644 --- a/plat/build.mk +++ b/plat/build.mk @@ -11,14 +11,21 @@ define build-platform-impl $(eval q := $D/descr) $(call installto, $(PLATIND)/descr/$(PLATFORM)) - $(foreach f, $1, $(call build-platform-headers, $f)) - $(eval PLATFORM_$(PLATFORM) := \ $(PLATFORM_HEADERS_$(PLATFORM)) \ $(PLATDEP)/$(PLATFORM)/ncg) + $(foreach f, $(platform-headers), $(call build-platform-headers, $f)) + + $(call reset) + $(foreach f, $(platform-libsys), $(call ackfile, $D/libsys/$f)) + $(call acklibrary, $(LIBDIR)/$(PLATFORM)/libsys.a) + $(call installto, $(PLATIND)/$(PLATFORM)/libsys.a) + $(call build-as) $(call build-ncg) + + $(foreach runtime, $(RUNTIMES), $(build-runtime-$(runtime))) endef build-platform = $(eval $(call build-platform-impl, $1)) diff --git a/plat/cpm/build.mk b/plat/cpm/build.mk index 83f029fb5..2f8836956 100644 --- a/plat/cpm/build.mk +++ b/plat/cpm/build.mk @@ -4,11 +4,31 @@ OPTIMISATION := -O D := plat/cpm -$(eval $(call build-platform, \ +platform-headers := \ ack/config.h \ cpm.h \ - unistd.h \ -)) + unistd.h + +platform-libsys := \ + _bdos.s \ + _hol0.s \ + _inn2.s \ + _trap.s \ + brk.c \ + close.c \ + creat.c \ + errno.s \ + getpid.c \ + isatty.c \ + kill.c \ + lseek.c \ + open.c \ + read.c \ + signal.c \ + time.c \ + write.c + +$(eval $(call build-platform)) + -include plat/cpm/libsys/build.mk diff --git a/plat/cpm/libsys/build.mk b/plat/cpm/libsys/build.mk deleted file mode 100644 index be6dfa335..000000000 --- a/plat/cpm/libsys/build.mk +++ /dev/null @@ -1,28 +0,0 @@ -D := plat/cpm/libsys - -define build-cpm-libsys-impl - $(call reset) - $(call ackfile, $D/_bdos.s) - $(call ackfile, $D/_hol0.s) - $(call ackfile, $D/_inn2.s) - $(call ackfile, $D/_trap.s) - $(call ackfile, $D/brk.c) - $(call ackfile, $D/close.c) - $(call ackfile, $D/creat.c) - $(call ackfile, $D/errno.s) - $(call ackfile, $D/getpid.c) - $(call ackfile, $D/isatty.c) - $(call ackfile, $D/kill.c) - $(call ackfile, $D/lseek.c) - $(call ackfile, $D/open.c) - $(call ackfile, $D/read.c) - $(call ackfile, $D/signal.c) - $(call ackfile, $D/time.c) - $(call ackfile, $D/write.c) - - $(call acklibrary, $(LIBDIR)/$(PLATFORM)/libsys.a) - $(call installto, $(PLATIND)/$(PLATFORM)/libsys.a) -endef - -$(eval $(build-cpm-libsys-impl)) - diff --git a/plat/linux/liblinux/build.mk b/plat/linux/liblinux/build.mk new file mode 100644 index 000000000..3cff634f9 --- /dev/null +++ b/plat/linux/liblinux/build.mk @@ -0,0 +1,27 @@ +define build-liblinux-impl + +$(call reset) +$(eval objdir := $(PLATFORM)) +$(call ackfile, plat/linux/liblinux/_exit.c) +$(call ackfile, plat/linux/liblinux/_hol0.s) +$(call ackfile, plat/linux/liblinux/brk.c) +$(call ackfile, plat/linux/liblinux/close.c) +$(call ackfile, plat/linux/liblinux/creat.c) +$(call ackfile, plat/linux/liblinux/errno.s) +$(call ackfile, plat/linux/liblinux/getpid.c) +$(call ackfile, plat/linux/liblinux/gettimeofday.c) +$(call ackfile, plat/linux/liblinux/isatty.c) +$(call ackfile, plat/linux/liblinux/kill.c) +$(call ackfile, plat/linux/liblinux/lseek.c) +$(call ackfile, plat/linux/liblinux/open.c) +$(call ackfile, plat/linux/liblinux/read.c) +$(call ackfile, plat/linux/liblinux/sbrk.c) +$(call ackfile, plat/linux/liblinux/signal.c) +$(call ackfile, plat/linux/liblinux/write.c) + +$(call acklibrary, $(OBJDIR)/$D/liblinux.a) +$(call installto, $(PLATIND)/$(PLATFORM)/liblinux.a) + +endef + +build-liblinux = $(eval $(build-liblinux-impl)) diff --git a/plat/linux386/build.mk b/plat/linux386/build.mk new file mode 100644 index 000000000..760cc69f6 --- /dev/null +++ b/plat/linux386/build.mk @@ -0,0 +1,17 @@ +ARCH := i386 +PLATFORM := linux386 +OPTIMISATION := -O + +D := plat/linux386/ + +platform-headers := \ + ack/config.h \ + sys/ioctl.h \ + unistd.h + +platform-libsys := \ + _syscall.s + +$(eval $(call build-platform)) +$(eval $(call build-liblinux)) + diff --git a/plat/linux386/descr b/plat/linux386/descr index 6b7b1a0af..73fbf1779 100644 --- a/plat/linux386/descr +++ b/plat/linux386/descr @@ -10,7 +10,7 @@ var f=4 var d=8 var ARCH=i386 var PLATFORM=linux386 -var PLATFORMDIR={EM}/lib/{PLATFORM} +var PLATFORMDIR={EM}/share/ack/{PLATFORM} var CPP_F=-D__unix var ALIGN=-a0:4 -a1:4 -a2:4 -a3:4 -b0:0x08048054 var C_LIB={PLATFORMDIR}/libc-ansi.a @@ -22,12 +22,12 @@ var MACHOPT_F=-m10 # Override the setting in fe so that files compiled for linux386 can see # the platform-specific headers. -var C_INCLUDES=-I{PLATFORMDIR}/include -I{EM}/include/ansi +var C_INCLUDES=-I{PLATFORMDIR}/include -I{EM}/share/ack/include/ansi name be from .m.g to .s - program {EM}/lib.bin/{PLATFORM}/ncg + program {EM}/lib/ack/{PLATFORM}/ncg mapflag -gdb GF=-gdb args {GF?} < stdout @@ -36,14 +36,14 @@ end name as from .s.so to .o - program {EM}/lib.bin/{PLATFORM}/as + program {EM}/lib/ack/{PLATFORM}/as args - -o > < prep cond end name led from .o.a to .out - program {EM}/lib.bin/em_led + program {EM}/lib/ack/em_led mapflag -l* LNAME={PLATFORMDIR}/lib* mapflag -fp FLOATS={EM}/{LIB}fp args {ALIGN} {SEPID?} \ diff --git a/plat/linux68k/build.mk b/plat/linux68k/build.mk new file mode 100644 index 000000000..b230b2500 --- /dev/null +++ b/plat/linux68k/build.mk @@ -0,0 +1,18 @@ +ARCH := m68020 +PLATFORM := linux68k +OPTIMISATION := -O6 + +D := plat/linux68k/ + +platform-headers := \ + ack/config.h \ + sys/ioctl.h \ + unistd.h + +platform-libsys := \ + _syscall.s + +$(eval $(call build-platform)) +$(eval $(call build-liblinux)) + + diff --git a/plat/linux68k/descr b/plat/linux68k/descr index 4758a48c2..1fb157c59 100644 --- a/plat/linux68k/descr +++ b/plat/linux68k/descr @@ -10,7 +10,7 @@ var f=4 var d=8 var ARCH=m68020 var PLATFORM=linux68k -var PLATFORMDIR={EM}/lib/{PLATFORM} +var PLATFORMDIR={EM}/share/ack/{PLATFORM} var CPP_F=-D__unix -D__mc68020 -D__m68k -D__mc68000 -D__M68020 var ALIGN=-a0:4 -a1:4 -a2:4 -a3:4 -b0:0x08000054 var C_LIB={PLATFORMDIR}/libc-ansi.a @@ -22,12 +22,12 @@ var MACHOPT_F=-ml10 # Override the setting in fe so that files compiled for linux68k can see # the platform-specific headers. -var C_INCLUDES=-I{PLATFORMDIR}/include -I{EM}/include/ansi +var C_INCLUDES=-I{PLATFORMDIR}/include -I{EM}/share/ack/include/ansi name be from .m.g to .s - program {EM}/lib.bin/{PLATFORM}/ncg + program {EM}/lib/ack/{PLATFORM}/ncg mapflag -gdb GF=-gdb args {GF?} < stdout @@ -36,14 +36,14 @@ end name as from .s.so to .o - program {EM}/lib.bin/{PLATFORM}/as + program {EM}/lib/ack/{PLATFORM}/as args - -o > < prep cond end name led from .o.a to .out - program {EM}/lib.bin/em_led + program {EM}/lib/ack/em_led mapflag -l* LNAME={PLATFORMDIR}/lib* mapflag -fp FLOATS={EM}/{LIB}fp args {ALIGN} {SEPID?} \ diff --git a/plat/linuxppc/build.mk b/plat/linuxppc/build.mk new file mode 100644 index 000000000..515d498a6 --- /dev/null +++ b/plat/linuxppc/build.mk @@ -0,0 +1,19 @@ +ARCH := powerpc +PLATFORM := linuxppc +OPTIMISATION := -O6 + +D := plat/linuxppc/ + +platform-headers := \ + ack/config.h \ + sys/ioctl.h \ + unistd.h + +platform-libsys := \ + _syscall.s \ + trap.s + +$(eval $(call build-platform)) +$(eval $(call build-liblinux)) + + diff --git a/plat/linuxppc/descr b/plat/linuxppc/descr index 64f838e61..2e54a5da8 100644 --- a/plat/linuxppc/descr +++ b/plat/linuxppc/descr @@ -10,7 +10,7 @@ var f=4 var d=8 var ARCH=powerpc var PLATFORM=linuxppc -var PLATFORMDIR={EM}/lib/{PLATFORM} +var PLATFORMDIR={EM}/share/ack/{PLATFORM} var CPP_F=-D__unix -D__POWERPC var ALIGN=-a0:4 -a1:4 -a2:4 -a3:4 -b0:0x80000054 var C_LIB={PLATFORMDIR}/libc-ansi.a @@ -22,12 +22,12 @@ var MACHOPT_F= # Override the setting in fe so that files compiled for linuxppc can see # the platform-specific headers. -var C_INCLUDES=-I{PLATFORMDIR}/include -I{EM}/include/ansi +var C_INCLUDES=-I{PLATFORMDIR}/include -I{EM}/share/ack/include/ansi name be from .m.g to .s - program {EM}/lib.bin/{PLATFORM}/ncg + program {EM}/lib/ack/{PLATFORM}/ncg mapflag -gdb GF=-gdb args {GF?} < stdout @@ -36,7 +36,7 @@ end name asopt from .s to .so - program {EM}/lib.bin/{PLATFORM}/top + program {EM}/lib/ack/{PLATFORM}/top args optimizer stdin @@ -45,14 +45,14 @@ end name as from .s.so to .o - program {EM}/lib.bin/{PLATFORM}/as + program {EM}/lib/ack/{PLATFORM}/as args - -o > < prep cond end name led from .o.a to .out - program {EM}/lib.bin/em_led + program {EM}/lib/ack/em_led mapflag -l* LNAME={PLATFORMDIR}/lib* mapflag -fp FLOATS={EM}/{LIB}fp args {ALIGN} {SEPID?} \ diff --git a/plat/pc86/build.mk b/plat/pc86/build.mk index e7e67136c..8a7ec92f1 100644 --- a/plat/pc86/build.mk +++ b/plat/pc86/build.mk @@ -4,11 +4,28 @@ OPTIMISATION := -O D := plat/pc86/ -$(eval $(call build-platform, \ +platform-headers := \ ack/config.h \ - unistd.h \ -)) + unistd.h -include plat/pc86/libsys/build.mk +platform-libsys := \ + errno.s \ + _hol0.s \ + _sys_rawread.s \ + _sys_rawwrite.s \ + open.c \ + creat.c \ + close.c \ + read.c \ + write.c \ + brk.c \ + getpid.c \ + kill.c \ + isatty.c \ + lseek.c \ + time.c \ + signal.c + +$(eval $(call build-platform)) diff --git a/plat/pc86/libsys/build.mk b/plat/pc86/libsys/build.mk deleted file mode 100644 index bf0fda6d5..000000000 --- a/plat/pc86/libsys/build.mk +++ /dev/null @@ -1,26 +0,0 @@ -D := plat/pc86/libsys - -define build-pc86-libsys-impl - $(call reset) - $(call ackfile, $D/errno.s) - $(call ackfile, $D/_hol0.s) - $(call ackfile, $D/_sys_rawread.s) - $(call ackfile, $D/_sys_rawwrite.s) - $(call ackfile, $D/open.c) - $(call ackfile, $D/creat.c) - $(call ackfile, $D/close.c) - $(call ackfile, $D/read.c) - $(call ackfile, $D/write.c) - $(call ackfile, $D/brk.c) - $(call ackfile, $D/getpid.c) - $(call ackfile, $D/kill.c) - $(call ackfile, $D/isatty.c) - $(call ackfile, $D/lseek.c) - $(call ackfile, $D/time.c) - $(call ackfile, $D/signal.c) - $(call acklibrary, $(LIBDIR)/$(PLATFORM)/libsys.a) - $(call installto, $(PLATIND)/$(PLATFORM)/libsys.a) -endef - -$(eval $(build-pc86-libsys-impl)) - diff --git a/util/cmisc/build.mk b/util/cmisc/build.mk index 185c3ace6..ae4b7fb2c 100644 --- a/util/cmisc/build.mk +++ b/util/cmisc/build.mk @@ -16,7 +16,7 @@ $(eval $(build-tabgen-impl)) # Output file is compiled with cfile and queued. define tabgen-impl -$(eval g := $(OBJDIR)/$(strip $1).c) +$(eval g := $(OBJDIR)/$(objdir)/$(strip $1).c) $g: $1 $(TABGEN) @echo TABGEN $g @@ -24,8 +24,9 @@ $g: $1 $(TABGEN) $(hide) $(TABGEN) -f$(strip $1) > $g || $(RM) $g $(eval CLEANABLES += $g) -$(call cfile,$g) +$(call $2,$g) endef -tabgen = $(eval $(call tabgen-impl,$1)) +tabgen = $(eval $(call tabgen-impl,$1,cfile)) +acktabgen = $(eval $(call tabgen-impl,$1,ackfile)) diff --git a/util/data/build.mk b/util/data/build.mk index 196bdd52a..c9b601da1 100644 --- a/util/data/build.mk +++ b/util/data/build.mk @@ -11,7 +11,8 @@ $(eval g := \ $(OBJDIR)/$D/em_mnem.c) $(eval CLEANABLES += $g) -$g: $D/new_table h/em_table +$(wordlist 2, $(words $g), $g): $(firstword $g) +$(firstword $g): $D/new_table h/em_table @echo DATA @mkdir -p $(dir $g) $(hide) $D/new_table h/em_table $(INCDIR) $(OBJDIR)/$D diff --git a/util/misc/build.mk b/util/misc/build.mk new file mode 100644 index 000000000..52367113c --- /dev/null +++ b/util/misc/build.mk @@ -0,0 +1,48 @@ +D := util/misc + +define build-misc-impl + $(call reset) + $(call cfile, $D/esize.c) + $(call cprogram, $(BINDIR)/esize) + $(call installto, $(INSDIR)/bin/esize) + + $(call reset) + $(eval q := $D/esize.1) + $(call installto, $(INSDIR)/share/man/man1/esize.1) + + $(call reset) + $(eval objdir := encode) + $(call cfile, $D/convert.c) + $(eval $q: $(INCDIR)/em_comp.h $(INCDIR)/em_codeEK.h) + $(call file, $(LIBREAD_EMEV)) + $(call file, $(LIBEMK)) + $(call file, $(LIBEM_DATA)) + $(call file, $(LIBALLOC)) + $(call file, $(LIBPRINT)) + $(call file, $(LIBSTRING)) + $(call file, $(LIBSYSTEM)) + $(call cprogram, $(BINDIR)/em_encode) + $(call installto, $(PLATDEP)/em_encode) + $(eval EM_ENCODE := $o) + + $(call reset) + $(eval objdir := decode) + $(call cfile, $D/convert.c) + $(eval $q: $(INCDIR)/em_comp.h $(INCDIR)/em_codeEK.h) + $(call file, $(LIBREAD_EMKV)) + $(call file, $(LIBEME)) + $(call file, $(LIBEM_DATA)) + $(call file, $(LIBALLOC)) + $(call file, $(LIBPRINT)) + $(call file, $(LIBSTRING)) + $(call file, $(LIBSYSTEM)) + $(call cprogram, $(BINDIR)/em_decode) + $(call installto, $(PLATDEP)/em_decode) + $(eval EM_DECODE := $o) + + $(call reset) + $(eval q := $D/em_decode.6) + $(call installto, $(INSDIR)/share/man/man6/em_decode.6) +endef + +$(eval $(build-misc-impl))