home *** CD-ROM | disk | FTP | other *** search
/ Atari FTP / ATARI_FTP_0693.zip / ATARI_FTP_0693 / Mint / mntlib32.zoo / purec / makefile < prev    next >
Makefile  |  1993-06-17  |  17KB  |  611 lines

  1. ### Makefile for MiNT Library for Pure C and Turbo C
  2. ### hohmuth 19 Feb 1993
  3. ###
  4. ### This makefile needs GNU make.
  5. ###
  6. ### This makefile is pretty tough.. Make sure your make has a large stack!
  7. ### (The MiNT library's standard stack size (8K) is _not_ enough!)
  8.  
  9. ###
  10. ### begin of configuration section
  11. ###
  12.  
  13. # TURBOC= yes if you still use Turbo C.
  14. # If you do so, I strongly suggest upgrading to Pure C.
  15. # Comment this out if you use Pure C.
  16.  
  17. #TURBOC=        yes
  18.  
  19. # COMPILERDIR= the main directory of your Turbo/Pure C installation
  20. # As file names in rules may not contain colons (`:'), this path
  21. # name should _not_ contain a TOS-style drive specification (like "c:").
  22. # If you define TOSIFY_COMMANDS below, this path will be automatically 
  23. # tosified.
  24.  
  25. #COMPILERDIR=    /dev/g/turboc
  26. COMPILERDIR=    /dev/d/pc
  27.  
  28. # BINDIR= where your compiler's tools (pcc.ttp, plink.ttp etc.) reside
  29.  
  30. #BINDIR=        $(COMPILERDIR)
  31. BINDIR=        $(COMPILERDIR)/bin
  32.  
  33. # LIBDIR= where to search for the compiler's libraries. Some of them are
  34. # linked into the MiNT library.
  35.  
  36. LIBDIR=        $(COMPILERDIR)/lib
  37.  
  38. # COMPILERINCDIR= where to find your compiler's includes, especially
  39. # float.h and math.h.
  40. # This is only needed during "make install-includes".
  41.  
  42. COMPILERINCDIR=    $(COMPILERDIR)/include
  43.  
  44. # INCLUDEDIR= where your MiNT library's include files (mntinc) reside.
  45. # If you define TOSIFY_NAMES below, this is path will be automatically 
  46. # tosified for the compiler's -I switch.
  47.  
  48. INCLUDEDIR=    /dev/g/gnu/include
  49.  
  50. # OSBINDLIB= the location of the osbind library by Ole Arndt und 
  51. # Ulf Moeller, if you have it.  This library replaces our TOS bindings.
  52. # If you use Turbo C, and don't have `awk', you _should_ get this library.
  53. # If you don't have it, you need to have `awk'.  (we need to hack our
  54. # TOS bindings) 
  55. # For Pure C users: You don't need to have this library.
  56. # Comment this out, if you don't have the osbind library.
  57.  
  58. #OSBINDLIB=    $(LIBDIR)/osbind.lib
  59.  
  60. # INSTALLDIR= the directory you want to have the MiNT library installed to.
  61. # This is only needed during "make install".
  62.  
  63. INSTALLDIR=    $(LIBDIR)
  64.  
  65. # COMMONDIR= where the main bulk of the library source resides
  66.  
  67. COMMONDIR=    ..
  68.  
  69. # ASSERTIONS= yes if you want to activate the library's calls to assert().
  70. # Comment this out if you don't.
  71.  
  72. #ASSERTIONS=    yes
  73.  
  74. # DEBUGINFO= yes, if you want your libraries created with debug info.
  75. # Comment this out if you don't.
  76.  
  77. #DEBUGINFO=    yes
  78.  
  79. # PCREL= yes, if you want all sub-routine calls to be PC relative.
  80. # This can cause problems with bigger projects, however.
  81. # Comment this out if you prefer absolute calls to sub-routines.
  82.  
  83. #PCREL= yes
  84.  
  85. # TOSIFY_NAMES= yes if the compiler's tools (pcc, plink etc.) don't 
  86. # understand Unix-like path names.
  87. # Comment this out if your compiler _does_ understand names like "/dev/c/foo".
  88.  
  89. TOSIFY_NAMES=    yes
  90.  
  91. # TOSIFY_COMMANDS= yes if your shell (see SHELL below) wants path names
  92. # in TOS form (i.e. does not understand unix compatible file names like
  93. # "/dev/c/foo"). Mupfel wants this.
  94. # Comment this out if your shell groks names like "/dev/c/foo".
  95. # NOTE: your versions of rm, cp, etc. _should_ understand
  96. #       unix-like names
  97.  
  98. #TOSIFY_COMMANDS=    yes
  99.  
  100. # sh_backslash= the string that should be passed to the shell as a single
  101. # backslash character. This depends on your shell (whether your
  102. # shell needs backslashes escaped with another backslash, as do most
  103. # unix-like shells). On contrast, Mupfel wants only one backslash, as well
  104. # as the shell that comes with `elvis'.
  105.  
  106. sh_backslash=    \\
  107. #sh_backslash=    \$(nothing)
  108.  
  109. # SHELL, RM, CP, INSTALL_DATA, SED, ECHO: edit to suite your taste
  110. # These programs _should_ understand unix-like path names (like "/dev/c/foo").
  111. # INSTALL_DATA is only needed during "make install" and "make install-includes".
  112. # AWK is only needed when using Turbo C without the osbind library (see
  113. # explanation on OSBINDLIB above)
  114. # ECHO is only needed with Turbo C.
  115. #
  116. # all of these programs should understand the ARGV scheme.
  117.  
  118. SHELL=        /bin/sh            # a bourne shell
  119. #SHELL=        /usr/local/bin/bash    # GNU bash
  120. #SHELL=        c:/usr/gemini/1.89/mupfel.ttp # Mupfel 1.89 (don't try 1.21)
  121. #SHELL=        c:/bin/shell.ttp    # simple shell (from `elvis' distribution)
  122. #SHELL=                    # no shell at all (works only with Pure C)
  123.  
  124. RM=        rm
  125. CP=        cp
  126. AWK=        awk
  127. ECHO=        echo
  128. INSTALL_DATA=    cp
  129. #INSTALL_DATA=    install -m 644
  130.  
  131. ###
  132. ### end of configuration section
  133. ###
  134.  
  135. ### the compiler programs, and what flags they need
  136.  
  137. ifdef TOSIFY_NAMES
  138.   DIRSEP=    $(sh_backslash)
  139. else
  140.   DIRSEP=    /
  141. endif
  142.  
  143. ifdef TURBOC
  144.   CC :=        $(BINDIR)/tcc.ttp -W
  145.   AS :=        $(BINDIR)/mas.ttp
  146.   LD :=        $(BINDIR)/tlink.ttp
  147. else
  148.   CC :=        $(BINDIR)/pcc.ttp -W
  149.   AS :=        $(BINDIR)/pasm.ttp
  150.   LD :=        $(BINDIR)/plink.ttp
  151. endif
  152.  
  153. ifdef TOSIFY_COMMANDS
  154.   tosify_name := $(CC)
  155.   include tosify.mak
  156.   CC := $(tosify_name)
  157.  
  158.   tosify_name := $(AS)
  159.   include tosify.mak
  160.   AS := $(tosify_name)
  161.  
  162.   tosify_name := $(LD)
  163.   include tosify.mak
  164.   LD := $(tosify_name)
  165. endif
  166.  
  167. ifdef DEBUGINFO
  168.   CCSYMFLAGS=    -Y
  169.   ifdef TURBOC
  170.     ASSYMFLAGS=
  171.   else
  172.     ASSYMFLAGS=    -Y
  173.   endif
  174.   LDSYMFLAGS=    -G -L -Y
  175. else
  176.   CCSYMFLAGS=
  177.   ASSYMFLAGS=
  178.   LDSYMFLAGS=    -G
  179. endif
  180.  
  181. ifdef PCREL
  182.   CCRELFLAGS=
  183. else
  184.   CCRELFLAGS=    -P
  185. endif
  186.  
  187. MAKEOBJ=    -J
  188.  
  189. ifdef ASSERTIONS
  190.   CCDEBUGDEFS=
  191. else
  192.   CCDEBUGDEFS=    -DNDEBUG
  193. endif
  194.  
  195. INCSPEC :=    $(INCLUDEDIR)
  196.  
  197. # tosify the include specification
  198. ifdef TOSIFY_NAMES
  199.   tosify_name := $(INCSPEC)
  200.   include tosify.mak
  201.   INCSPEC := $(tosify_name)
  202. endif
  203.  
  204. CCINCFLAGS=    -I$(INCSPEC)
  205.  
  206. # with Turbo C, we need to work around its missing ARGV capability
  207. ifdef TURBOC
  208.   ARGV_WORKAROUND=    yes
  209. else
  210.   ARGV_WORKAROUND=
  211. endif
  212.  
  213. ### default flags to compiler, linker, assembler
  214.  
  215. CCFLAGS=    $(CCINCFLAGS) $(CCSYMFLAGS) $(CCRELFLAGS) $(CCDEBUGDEFS)
  216. ASFLAGS=    $(ASSYMFLAGS)
  217. LDFLAGS=    $(LDSYMFLAGS)
  218.  
  219. ### what to build
  220.  
  221. MINTLIB=    mintlib.lib
  222. MATHLIB=    mintflt.lib
  223. FPUMATHLIB=    mint881.lib
  224. STARTUPOBJ=    crt0.o
  225. ALLOCAOBJ=    alloca.o
  226. FPUALLOCAOBJ=    falloca.o
  227.  
  228. MYTOSLIB=    myosbind.lib
  229.  
  230. DIST_MATHLIB=    d_flt.lib
  231. DIST_FPUMATHLIB=    d_881.lib
  232.  
  233. ifdef TURBOC
  234.   ALL=        $(MINTLIB) $(MATHLIB) $(STARTUPOBJ) $(ALLOCAOBJ)
  235.   BINDIST=    $(MINTLIB) $(DIST_MATHLIB) $(STARTUPOBJ) $(ALLOCAOBJ)
  236. else
  237.   ALL=        $(MINTLIB) $(MATHLIB) $(STARTUPOBJ) $(ALLOCAOBJ) \
  238.     $(FPUMATHLIB) $(FPUALLOCAOBJ)
  239.   BINDIST=    $(MINTLIB) $(DIST_MATHLIB) $(STARTUPOBJ) $(ALLOCAOBJ) \
  240.     $(DIST_FPUMATHLIB) $(FPUALLOCAOBJ)
  241. endif
  242.  
  243. .PHONY:        all
  244. all:        $(ALL)
  245.  
  246. .PHONY:        bindist
  247. bindist:    $(BINDIST)
  248.  
  249. ### things we link from the compiler's distribution
  250.  
  251. ifdef TURBOC
  252.   CCFLOATLIB :=    $(LIBDIR)/tcfltlib.lib
  253. else
  254.   CCFLOATLIB :=    $(LIBDIR)/pcfltlib.lib
  255.   CC881LIB :=    $(LIBDIR)/pc881lib.lib
  256. endif
  257.  
  258. CCFLOATLIBSPEC :=    $(CCFLOATLIB)
  259. CC881LIBSPEC :=    $(CC881LIB)
  260.  
  261. # tosify the library specifications, if nessecary
  262. ifdef TOSIFY_NAMES
  263.   tosify_name := $(CCFLOATLIBSPEC)
  264.   include tosify.mak
  265.   CCFLOATLIBSPEC := $(tosify_name)
  266.  
  267.   tosify_name := $(CC881LIBSPEC)
  268.   include tosify.mak
  269.   CC881LIBSPEC := $(tosify_name)
  270. endif
  271.  
  272. ### which OS bindings library to link
  273.  
  274. # the osbind library replaces our tos library.
  275. ifdef OSBINDLIB
  276.   TOSLIB :=    $(OSBINDLIB)
  277. else
  278.   ifdef TURBOC
  279.     TOSLIB :=    $(MYTOSLIB)
  280.  
  281.     # file dependency
  282.     $(MINTLIB):    $(MYTOSLIB)
  283.   else
  284.     TOSLIB :=
  285.   endif
  286. endif
  287.  
  288. TOSLIBSPEC :=    $(TOSLIB)
  289.  
  290. # tosify the library specification, if nessecary
  291. ifdef TOSIFY_NAMES
  292.   tosify_name := $(TOSLIBSPEC)
  293.   include tosify.mak
  294.   TOSLIBSPEC := $(tosify_name)
  295. endif
  296.  
  297. ### how to build MINTLIB
  298.  
  299. COMMONSRC :=    a64l.c abort.c abs.c access.c alarm.c alphasor.c atexit.c \
  300.   atol.c bblink.c bcmp.c binmode.c bsearch.c calloc.c chdir.c chmod.c \
  301.   clock.c close.c console.c crtinit.c ctermid.c \
  302.   ctime.c ctype.c defmode.c dirent.c \
  303.   doprnt.c dup.c eprintf.c exec.c execp.c fclose.c fcntl.c fdopen.c fflush.c \
  304.   fgetc.c fgets.c filbuf.c findfile.c fopen.c fopenp.c fork.c fprintf.c \
  305.   fputc.c fputs.c fread.c frwbin.c fscanf.c fseek.c fsetpos.c ftw.c \
  306.   fungetc.c fwrite.c getbuf.c getcwd.c getdtabl.c getenv.c getgroup.c \
  307.   gethostn.c getlogin.c getopt.c getpages.c getpass.c getpid.c getpw.c \
  308.   getrusag.c gets.c getuid.c getw.c grp.c heapbase.c ic.c ident.c ig.c \
  309.   il.c inistack.c initsig.c ioctl.c ip.c isatty.c iw.c kill.c killpg.c \
  310.   link.c localtim.c lockf.c lseek.c ltoa.c main.c malloc.c memccpy.c \
  311.   memchr.c memcmp.c mkdir.c mknod.c mktemp.c nice.c obstack.c open.c \
  312.   pause.c perror.c pipe.c pgrp.c popen.c psignal.c putenv.c qsort.c raise.c \
  313.   rand.c random.c read.c realloc.c regexp.c regsup.c rename.c rmdir.c \
  314.   sbrk.c scandir.c scanf.c select.c setbuf.c setlocal.c setrlimi.c \
  315.   setvbuf.c sgtty.c sigactio.c sigblock.c siglist.c signal.c sleep.c \
  316.   spawn.c spawnve.c spawnvp.c sprintf.c sscanf.c stat.c statfs.c stksiz.c \
  317.   strcat.c strchr.c strcmp.c strcoll.c strcpy.c strcspn.c strdup.c \
  318.   strerror.c strftime.c stricmp.c strlen.c strlwr.c strncat.c strncmp.c \
  319.   strncpy.c strnicmp.c strpbrk.c strrchr.c strrev.c strspn.c strstr.c \
  320.   strtok.c strtol.c strtoul.c strupr.c symlink.c sysconf.c system.c \
  321.   sysvar.c textio.c thread.c time.c timeoday.c times.c tmpfile.c tmpnam.c \
  322.   toxxx.c ttyname.c uname.c unlink.c unx2dos.c utime.c utmp.c wait.c \
  323.   wait3.c waitpid.c write.c wtmp.c 
  324. COMMONSRC := $(addprefix $(COMMONDIR)/,$(COMMONSRC))
  325.  
  326. SRC :=        bzero.c memset.c alloca2.c \
  327.   bcopy.s linea.s setjmp.s vfork.s
  328.  
  329. ifndef TOSLIB
  330.   # no tos bindings library -- link our bindings.
  331.   SRC :=    $(SRC) osbind.s bios.s xbios.s gemdos.s mintbind.s
  332.   bios.o xbios.o gemdos.o mintbind.o:    osmacros.s
  333. endif
  334.  
  335. ifdef TURBOC
  336.   SUPPORTSRC=    fpuinit.c stkover.s
  337. else
  338.   SUPPORTSRC=    fpuinit.c stkover.s pclong.s 
  339. endif
  340.  
  341. MINTSRC=    $(COMMONSRC) $(SUPPORTSRC) $(SRC)
  342.  
  343. MINTOBJ :=    $(patsubst %.c,%.o,$(MINTSRC))
  344. MINTOBJ :=    $(patsubst %.s,%.o,$(MINTOBJ))
  345.  
  346. ifdef ARGV_WORKAROUND
  347.   MINTLIB_CMD=    $(basename $(MINTLIB)).cmd
  348.   MINTLIB_PARAM=    -C=$(MINTLIB_CMD)
  349.   MINTLIB_DEP=    $(MINTOBJ) $(MINTLIB_CMD)
  350.  
  351.   $(MINTLIB_CMD):
  352.     -$(RM) -f $@
  353.     $(ECHO) -n $(subst /,$(DIRSEP),$(MINTOBJ)) > $@
  354. else
  355.   MINTLIB_PARAM=    $(subst /,$(DIRSEP),$(MINTOBJ))
  356.   MINTLIB_DEP=    $(MINTOBJ)
  357. endif
  358.  
  359. ifneq (,$(wildcard $(firstword $(MINTSRC))))
  360.   $(MINTLIB):    $(MINTLIB_DEP)
  361.     $(LD) $(MAKEOBJ) $(LDFLAGS) -O=$@ $(MINTLIB_PARAM) $(TOSLIBSPEC)
  362. else
  363. # if the source is not present (binary distribution), we just check for
  364. # the presence of the library.
  365.   $(MINTLIB): ;
  366. endif
  367.  
  368. %.o:        %.s
  369.     $(AS) $(ASFLAGS) -O=$(subst /,$(DIRSEP),$@) $(subst /,$(DIRSEP),$<)
  370.  
  371. %.o:        %.c
  372.     $(CC) $(CCFLAGS) -D__NO_FLOAT__ \
  373.       -O$(subst /,$(DIRSEP),$@) $(subst /,$(DIRSEP),$<)
  374.  
  375. $(COMMONDIR)/crtinit.o:    $(COMMONDIR)/crtinit.c
  376.     $(CC) -P -S- -T- $(CCFLAGS) -D__NO_FLOAT__ \
  377.       -O$(subst /,$(DIRSEP),$@) $(subst /,$(DIRSEP),$<)
  378.  
  379. $(COMMONDIR)/main.o:    $(COMMONDIR)/main.c
  380.     $(CC) -P $(CCFLAGS) -D__NO_FLOAT__ \
  381.       -O$(subst /,$(DIRSEP),$@) $(subst /,$(DIRSEP),$<)
  382.  
  383. $(COMMONDIR)/qsort.o:    $(COMMONDIR)/qsort.c
  384.     $(CC) -S -T $(CCFLAGS) -D__NO_FLOAT__ \
  385.       -O$(subst /,$(DIRSEP),$@) $(subst /,$(DIRSEP),$<)
  386.  
  387. $(COMMONDIR)/thread.o:    $(COMMONDIR)/thread.c
  388.     $(CC) -P -S- $(CCFLAGS) -D__NO_FLOAT__ \
  389.       -O$(subst /,$(DIRSEP),$@) $(subst /,$(DIRSEP),$<)
  390.  
  391. setjmp.o:    setjmp.s
  392.     $(AS) $(ASFLAGS) -D=FPU=0 \
  393.       -O=$(subst /,$(DIRSEP),$@) $(subst /,$(DIRSEP),$<)
  394.  
  395. ### how to build MYTOSLIB, our own tos bindings library
  396.  
  397. ifdef TURBOC
  398.   # for Turbo C, this is quite tricky.  Turbo's assembler MAS doesn't
  399.   # understand the directives ".MODULE" and ".ENDMOD", but we still want
  400.   # one module per binding.  That's why we use awk to cut modules
  401.   # from the source files and build one object file per binding.
  402.  
  403.   MYBINDSRC :=    bios.s xbios.s gemdos.s mintbind.s
  404.   
  405.   # we make a list of object file we want to build and re-instantiate `make'.
  406.   # in the new instance, we include that list into our makefile
  407.   MAKEINCL :=    myosbind.mak
  408.  
  409.   ifndef MAKEINCL_OK
  410.     $(MAKEINCL):    $(MYBINDSRC)
  411.     $(AWK) 'BEGIN { FS = " |:|\t" ; printf "MYBINDOBJ := " } /^\.MODULE/ { printf "%s.o ", $$2 }' \
  412.       $^ > $@
  413.  
  414.     $(MYTOSLIB):    $(MYBINDSRC) osmacros.s osbind.s $(MAKEINCL)
  415.     $(MAKE) $(MYTOSLIB) MAKEINCL_OK=yes
  416.   else
  417.  
  418.     # this should define MYBINDOBJ
  419.     include $(MAKEINCL)
  420.  
  421.     $(MYBINDOBJ):    %.o:    $(MYBINDSRC) osmacros.s
  422.     -$(RM) -f temp.s
  423.     $(AWK) -v name=$(patsubst %.o,%,$@) -f filter.awk $(MYBINDSRC) > temp.s
  424.     $(AS) $(ASFLAGS) -O=$@ temp.s
  425.  
  426.     ifdef ARGV_WORKAROUND
  427.       MYTOSLIB_CMD=    $(basename $(MYTOSLIB)).cmd
  428.       MYTOSLIB_PARAM=    -C=$(MYTOSLIB_CMD)
  429.       MYTOSLIB_DEP=    $(MYBINDOBJ) $(MYTOSLIB_CMD)
  430.     
  431.       $(MYTOSLIB_CMD):    $(MAKEINCL)
  432.     -$(RM) -f $@
  433.     $(ECHO) -n $(MYBINDOBJ) > $@
  434.     else
  435.       MYTOSLIB_PARAM=    $(MYBINDOBJ)
  436.       MYTOSLIB_DEP=    $(MYBINDOBJ)
  437.     endif
  438.  
  439.     $(MYTOSLIB):    osbind.o $(MYTOSLIB_DEP)
  440.     $(LD) $(MAKEOBJ) $(LDFLAGS) -O=$@ osbind.o $(MYTOSLIB_PARAM)
  441.  
  442.   endif
  443. else
  444.   # with Pure C, everything's so much easier :-)
  445.   # however, it's unlikely that you'll need this.
  446.  
  447.   MYTOSSRC :=    osbind.s bios.s xbios.s gemdos.s mintbind.s
  448.   MYTOSOBJ :=    $(patsubst %.s,%.o,$(MYTOSSRC))
  449.  
  450.   bios.o xbios.o gemdos.o mintbind.o:    osmacros.s
  451.  
  452.   $(MYTOSLIB):    $(MYTOSOBJ)
  453.     $(LD) $(MAKEOBJ) $(LDFLAGS) -O=$@ $^
  454.  
  455. endif
  456.  
  457. ### how to build MATHLIB
  458.  
  459. MATHOBJ=    m_main.o m_doprnt.o m_scanf.o m_difftime.o
  460.  
  461. ifneq ($(DIST_MATHLIB),$(wildcard $(DIST_MATHLIB)))
  462.   $(MATHLIB):    $(MATHOBJ) # $(CCFLOATLIB)
  463.     $(LD) $(MAKEOBJ) $(LDFLAGS) -O=$@ \
  464.       $(subst /,$(DIRSEP),$(MATHOBJ)) $(CCFLOATLIBSPEC)
  465. else
  466. # link with the bindist's rudimentary math library, if it exists
  467.   $(MATHLIB):    $(DIST_MATHLIB) # $(CCFLOATLIB)
  468.     $(LD) $(MAKEOBJ) $(LDFLAGS) -O=$@ \
  469.       $(DIST_MATHLIB) $(CCFLOATLIBSPEC)
  470. endif
  471.  
  472. ifneq (,$(wildcard $(patsubst m_%.o,$(COMMONDIR)/%.c,$(firstword $(MATHOBJ)))))
  473.   $(DIST_MATHLIB):    $(MATHOBJ)
  474.     $(LD) $(MAKEOBJ) $(LDFLAGS) -O=$@ \
  475.       $(subst /,$(DIRSEP),$(MATHOBJ))
  476. else
  477. # if the source is not present (binary distribution), we just check for
  478. # the presence of the distributable library.
  479.   $(DIST_MATHLIB): ;
  480. endif
  481.  
  482. m_%.o:        $(COMMONDIR)/%.c
  483.     $(CC) -T- $(CCFLAGS) \
  484.       -O$(subst /,$(DIRSEP),$@) $(subst /,$(DIRSEP),$<)
  485.  
  486. m_main.o:    $(COMMONDIR)/main.c
  487.     $(CC) -T- -P $(CCFLAGS) \
  488.       -O$(subst /,$(DIRSEP),$@) $(subst /,$(DIRSEP),$<)
  489.  
  490. ### how to build FPUMATHLIB
  491.  
  492. FPUMATHOBJ =    f_main.o f_doprnt.o f_scanf.o f_difftime.o f_setjmp.o
  493.  
  494. ifneq ($(DIST_FPUMATHLIB),$(wildcard $(DIST_FPUMATHLIB)))
  495.   $(FPUMATHLIB):    $(FPUMATHOBJ) # $(CC881LIB)
  496.     $(LD) $(MAKEOBJ) $(LDFLAGS) -O=$@ \
  497.       $(subst /,$(DIRSEP),$(FPUMATHOBJ)) $(CC881LIBSPEC)
  498. else
  499. # link with the bindist's rudimentary math library, if it exists
  500.   $(FPUMATHLIB):    $(DIST_FPUMATHLIB) # $(CC881LIB)
  501.     $(LD) $(MAKEOBJ) $(LDFLAGS) -O=$@ \
  502.       $(DIST_FPUMATHLIB) $(CC881LIBSPEC)
  503. endif
  504.  
  505. ifneq (,$(wildcard $(patsubst f_%.o,$(COMMONDIR)/%.c,$(firstword $(FPUMATHOBJ)))))
  506.   $(DIST_FPUMATHLIB):    $(FPUMATHOBJ)
  507.     $(LD) $(MAKEOBJ) $(LDFLAGS) -O=$@ \
  508.       $(subst /,$(DIRSEP),$(FPUMATHOBJ))
  509. else
  510. # if the source is not present (binary distribution), we just check for
  511. # the presence of the distributable library.
  512.   $(DIST_FPUMATHLIB): ;
  513. endif
  514.  
  515. f_%.o:        $(COMMONDIR)/%.c
  516.     $(CC) -T- -8 $(CCFLAGS) \
  517.       -O$(subst /,$(DIRSEP),$@) $(subst /,$(DIRSEP),$<)
  518.  
  519. f_main.o:    $(COMMONDIR)/main.c
  520.     $(CC) -T- -8 -P $(CCFLAGS) \
  521.       -O$(subst /,$(DIRSEP),$@) $(subst /,$(DIRSEP),$<)
  522.  
  523. f_setjmp.o:    setjmp.s
  524.     $(AS) $(ASFLAGS) -D=FPU=1 \
  525.       -O=$(subst /,$(DIRSEP),$@) $(subst /,$(DIRSEP),$<)
  526.  
  527. ### how to build the startup code
  528.  
  529. STARTUPSRC=    crt0.s
  530.  
  531. ifneq (,$(wildcard $(STARTUPSRC)))
  532.   $(STARTUPOBJ):    $(STARTUPSRC)
  533.     $(AS) $(ASFLAGS) -O=$(subst /,$(DIRSEP),$@) $(subst /,$(DIRSEP),$<)
  534. else
  535. # if the source is not present (binary distribution), we just check for
  536. # the presence of the object files.
  537.   $(STARTUPOBJ): ;
  538. endif
  539.  
  540. ### how to build the fast versions of alloca()
  541.  
  542. ALLOCASRC=    alloca.s
  543.  
  544. ifneq (,$(wildcard $(ALLOCASRC)))
  545.   $(ALLOCAOBJ):    $(ALLOCASRC)
  546.     $(AS) $(ASFLAGS) -D=STACKCH=1 -D=FPU=0 \
  547.       -O=$(subst /,$(DIRSEP),$@) $(subst /,$(DIRSEP),$<)
  548.  
  549.   $(FPUALLOCAOBJ):    $(ALLOCASRC)
  550.     $(AS) $(ASFLAGS) -D=STACKCH=1 -D=FPU=1 \
  551.       -O=$(subst /,$(DIRSEP),$@) $(subst /,$(DIRSEP),$<)
  552. else
  553. # if the source is not present (binary distribution), we just check for
  554. # the presence of the object files.
  555.   $(ALLOCAOBJ): ;
  556.   $(FPUALLOCAOBJ): ;
  557. endif
  558.  
  559. ### how to build the test program
  560.  
  561. .PHONY:        test
  562. test:        test.tos
  563.  
  564. ifdef TURBOC
  565.   CCSTDLIB :=    $(LIBDIR)/tcstdlib.lib
  566.   CCSTDLIBSPEC :=    $(CCSTDLIB)
  567.   ifdef TOSIFY_NAMES
  568.     tosify_name :=    $(CCSTDLIBSPEC)
  569.     include tosify.mak
  570.     CCSTDLIBSPEC :=    $(tosify_name)
  571.   endif
  572.  
  573.   TEST_LINKLIBS=    $(CCSTDLIBSPEC)
  574. else
  575.   TEST_LINKLIBS=
  576. endif
  577.  
  578. test.tos:    $(MINTLIB) $(STARTUPOBJ) test.o
  579.     $(LD) $(LDFLAGS) -S=0 -O=$@ $(STARTUPOBJ) test.o \
  580.       $(MINTLIB) $(TEST_LINKLIBS)
  581.  
  582. test.o:        test.c
  583.     $(CC) -S $(CCFLAGS) -O$@ $<
  584.     
  585. ### how to make clean
  586.  
  587. .PHONY:        clean
  588. clean:
  589.     -$(RM) -f $(COMMONDIR)/*.o
  590.     -$(RM) -f *.o
  591.     -$(RM) -f *.cmd
  592.     -$(RM) -f temp.s test.tos
  593.  
  594. .PHONY:        realclean
  595. realclean:    clean
  596.     -$(RM) -f *.lib
  597. ifdef MAKEINCL
  598.     -$(RM) -f $(MAKEINCL)
  599. endif
  600.  
  601. ### how to install
  602.  
  603. .PHOHY:        install
  604. install:    $(ALL)
  605.     $(INSTALL_DATA) $(ALL) $(INSTALLDIR)
  606.  
  607. .PHONY:        install-includes
  608. install-includes:
  609.     $(INSTALL_DATA) $(COMPILERINCDIR)/float.h $(INCLUDEDIR)/tcfloat.h
  610.     $(INSTALL_DATA) $(COMPILERINCDIR)/math.h $(INCLUDEDIR)/tcmath.h
  611.