[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Makefiles for Mintlib / Finger(d) / Gcc questions
I found the existing Mintlib makefile very annoying when trying to compile
more than one variant of the libraries (e.g. normal and -mshort). Deleting
all the objects and rebuilding everything just for one or two small changes
is very frustrating (not to mention time consuming!).
I have rewritten the Makefile and mincl (I called it Make-include instead)
to build each variant in a separate subdirectory, using Gnu make's VPATH.
Now, after changing one source file, I can have multiple variants installed
in no time at all. I've appended the files below.
As MintOS doesn't have a real finger, I've ported the NetBSD version (fairly
simple). I've put sources/diffs and 020+ binaries on :
aire.ncl.ac.uk:/pub/Atari/Binaries/finger*
aire.ncl.ac.uk:/pub/Atari/Sources/finger*
http://aire.ncl.ac.uk:80/Atari/Binaries
http://aire.ncl.ac.uk:80/Atari/Sources
For gcc 2.6.3, what version of ld should I use? I have an old version
from the (bin?)utils 3.6 which doesn't understand libc.a and keeps looking
for gcc.olb instead. Can someone point me at an ftp site? Thanks.
Finally, which version of gcc do I need for it to recognise -G?
Thanks,
J
--
Core files are like Aero bars, you see.
---8<---------------------------- Cut here ---------------------------->8---
Makefile :
# Makefile for MiNTlibs
# Build with different flags in different sub-directories
# Almost certainly needs GNU Make
# Based on previos Mintlib makefiles from Bammi & Entropy
# Installs in /usr/lib/gcc-lib/... not /usr/lib by default. This is so I can
# run both gcc-m68k and gcc-m68000 compilers.
# Bugs: uses $@ to pass `argv', so multiple command line args cause multiple
# invocations of sub-makes
# JC 18 September 1995
# Files to build
CLIB = libc.a
IIOLIB = libiio.a
CRT0 = crt0.o
GCRT0 = gcrt0.o
# Programs to use
SH = /bin/sh
CC = gcc
AS = gcc
AR = ar
ifdef DEBUG
OPTIM = -O -g -Wstrict-prototypes
FRAME =
DEBUG =
DBGDIR = D
else
OPTIM = -O2 -fstrength-reduce
FRAME = -fomit-frame-pointer
DEBUG = -DNDEBUG
DBGDIR =
endif
# Directories to build in
DIR2 = $(DBGDIR)020
DIR2B = $(DBGDIR)020br
DIR2S = $(DBGDIR)020sh
DIR2BS = $(DBGDIR)020brsh
DIR0 = $(DBGDIR)000
DIR0B = $(DBGDIR)000brsh
DIR0S = $(DBGDIR)000sh
DIR0BS = $(DBGDIR)000br
DIR0F = $(DBGDIR)000sf
# All directories - need for distclean
DIRS = $(DIR2) $(DIR2B) $(DIR2S) $(DIR2BS)\
$(DIR0) $(DIR0B) $(DIR0S) $(DIR0BS)\
$(DIR0F)
# Install directories; uses Andreas' new gcc structure
020DEST = /usr/lib/gcc-lib/m68k-mint/2.6.3/
000DEST = /usr/lib/gcc-lib/m68000-mint/2.6.3/
BRLDEST = mbaserel/
SHTDEST = mshort/
INSTALL = install
INFLAGS = -m 644
MKDIR = mkdir
MDFLAGS = -p
# Check to see if this is the top level make
# If so add the targets to invoke ...
ifeq (0,${MAKELEVEL})
MFLAGS := $(MFLAGS) -f ../Makefile VPATH=..
all:
# Make in directories
%::
# 020
-$(MKDIR) $(DIR2)
cd $(DIR2) && LTARGET=20 $(MAKE) $(MFLAGS) $@
# 020 baserel
-$(MKDIR) $(DIR2B)
cd $(DIR2B) && LTARGET=20BR $(MAKE) $(MFLAGS) $@
# 020 short
-$(MKDIR) $(DIR2S)
cd $(DIR2S) && LTARGET=20SH $(MAKE) $(MFLAGS) $@
# 020 baserel short
# -$(MKDIR) $(DIR2BS)
# cd $(DIR2BS) && LTARGET=20BRSH $(MAKE) $(MFLAGS) $@
# 000
# -$(MKDIR) $(DIR0)
# cd $(DIR0) && LTARGET=00 $(MAKE) $(MFLAGS) $@
# 000 baserel
# -$(MKDIR) $(DIR0B)
# cd $(DIR0B) && LTARGET=00BR $(MAKE) $(MFLAGS) $@
# 000 short
# -$(MKDIR) $(DIR0S)
# cd $(DIR0S) && LTARGET=00SH $(MAKE) $(MFLAGS) $@
# 000 baserel short
# -$(MKDIR) $(DIR0BS)
# cd $(DIR0BS) && LTARGET=00BRSH $(MAKE) $(MFLAGS) $@
# 000 SFP004
# -$(MKDIR) $(DIR0F)
# cd $(DIR0F) && LTARGET=00SF $(MAKE) $(MFLAGS) $@
# ... otherwise, set the compilation options
else
ifneq (,$(findstring 20,$(LTARGET)))
CC := $(CC) -m68020
DESTDIR = $(020DEST)
endif
ifneq (,$(findstring 00,$(LTARGET)))
CC := $(CC) -m68000
DESTDIR = $(000DEST)
endif
ifneq (,$(findstring BR,$(LTARGET)))
CC := $(CC) -mbaserel
DESTDIR := $(DESTDIR)$(BRLDEST)
endif
ifneq (,$(findstring SH,$(LTARGET)))
SHORT = -mshort
DSHORT = -DSHORTLIB
DESTDIR := $(DESTDIR)$(SHTDEST)
else
SHORT =
DSHORT =
endif
ifneq (,$(findstring SF,$(LTARGET)))
SFPFLAG = -Dsfp004
else
SFPFLAG =
endif
all: $(CLIB) $(IIOLIB) $(CRT0) $(GCRT0)
endif
# Extra flags (Entropy)
#XPFLAGS = -nostdinc
#XFLAGS = $(XPFLAGS) -Wall -Wmissing-prototypes -Wstrict-prototypes
#XLFLAGS = -Wno-missing-prototypes -Wno-strict-prototypes
# Flags for extra 'long long' support under newer gcc's
#LONGLONG = -DPRINTF_LONGLONG
# Flags for extra long double support under newer gcc's
#XFLOAT = -DXFLOAT_ENABLE
# Common subset of options (no int size or omit-frame-pointer
COPTS = $(DEBUG) $(OPTIM) $(XFLAGS) $(SFPFLAG)
# Base CC options; includes int size but not omit-frame-pointer
CFFLAGS = $(SHORT) $(COPTS)
# Normal CFLAGS; includes int size and omit-frame-pointer
CFLAGS = $(CFFLAGS) $(FRAME) $(LONGLONG)
# Flags for files that need to be compiled with 32-bit ints
CLFLAGS = $(COPTS) $(FRAME) $(DSHORT) $(XFLOAT) $(XLFLAGS)
# Flags for $(CC) when it runs the assembler only
ASFLAGS = -c
# Flags for $(CC) when it runs the preprocessor and assembler only
PPFLAGS = $(XPFLAGS) $(SHORT) $(SFPFLAG) -P -c
# Include object & library lists
ifdef LTARGET
include ../Make-include
endif
distclean:
for d in $(DIRS);\
do if [ -d $$d ];\
then rmdir $$d;\
fi;\
done
---8<---------------------------- Cut here ---------------------------->8---
Make-include :
# Mintlibs Make include file
# Based on previos Mintlib mincl from Bammi & Entropy
# JC 27 August 1995
# GCC specific stuff
FCOMPD = _eqdf2.o _gtdf2.o _ledf2.o _gedf2.o _ltdf2.o
FCOMPS = _eqsf2.o _gtsf2.o _lesf2.o _gesf2.o _ltsf2.o
# Source for various sections
GLIB1 = _addsubd.o _addsubs.o _divdf3.o _divmods.o \
_divsf3.o _extends.o _fixdfsi.o _fxunsd.o _fltsi.o \
_muldf3.o _mulsf3.o _mulsi3.o _negdf2.o _negsf2.o _normdf.o _normsf.o \
_truncdf.o _udivmod.o _umulsi3.o _fixsfsi.o _fltsisf.o _isnan.o
GLIB2 = _muldi3.o _divdi3.o _moddi3.o _udivdi3.o _umoddi3.o _negdi2.o \
_lshrdi3.o _lshldi3.o _ashldi3.o _ashrdi3.o _udivmoddi4.o _cmpdi2.o \
_ucmpdi2.o _floatdidf.o _floatdisf.o _fixunsdfsi.o _fixunssfsi.o \
_fixunsdfdi.o _fixdfdi.o _fixunssfdi.o _fixsfdi.o _op_new.o \
_new_handler.o _op_delete.o _trampoline.o __main.o _ctor_list.o \
_dtor_list.o _ffsdi2.o _op_vnew.o _op_vdel.o _eh.o _pure.o
GCC= crtinit.o stksiz.o inistack.o heapbase.o binmode.o \
$(GLIB1) $(GLIB2) $(FCOMPD) $(FCOMPS) \
ldexp.o frexp.o modf.o alloca.o setjmp.o osbind.o\
linea.o alglobal.o thread.o sysvar.o gmon.o \
initsig.o bblink.o defmode.o
#
# ANSI stuff + support
ANSI = abort.o atexit.o atof.o atoi.o atol.o \
bsearch.o \
calloc.o clock.o ctime.o ctype.o \
difftime.o div.o doprnt.o \
eprintf.o \
fclose.o fdopen.o fflush.o fgetc.o fgetpos.o fgets.o filbuf.o \
fopen.o fopen_i.o fprintf.o fputc.o fputs.o \
fread.o freopen.o fscanf.o fseek.o ftell.o \
fsetpos.o fungetc.o fwrite.o \
getbuf.o getenv.o gets.o getw.o \
ldiv.o localtim.o ltoa.o \
main.o malloc.o \
printf.o puts.o \
qsort.o \
raise.o rand.o realloc.o rewind.o \
scanf.o sscanf.o setbuf.o setvbuf.o \
setlocal.o sprintf.o strftime.o strtol.o strtoul.o system.o \
tmpnam.o tmpfile.o toxxx.o \
vfprintf.o vfscanf.o vprintf.o vscanf.o \
wcmb.o wcscat.o wcscmp.o wcscpy.o wcslen.o wnull.o
#
# other miscellaneous stuff
PORT = a64l.o alphasor.o abs.o buffindf.o ctermid.o cuserid.o \
enoent.o \
ffs.o findfile.o fopenp.o frwbin.o ftw.o \
gethostn.o getlogin.o getopt.o getpages.o getpass.o getpw.o grp.o \
l64a.o labs.o \
mktemp.o nlist.o obstack.o \
random.o regexp.o regsup.o \
scandir.o strlwr.o strupr.o strrev.o sync.o \
textio.o truncate.o \
utmp.o wtmp.o \
ic.o ig.o il.o ip.o iw.o ident.o
#
# the string library
STRING = strcat.o strchr.o strcmp.o strcpy.o strcspn.o strdup.o \
strlen.o strncat.o strncmp.o strncpy.o strpbrk.o strrchr.o strspn.o \
strtok.o strstr.o memccpy.o memcmp.o memchr.o memset.o \
bcopy.o bcmp.o bzero.o strerror.o strcoll.o \
stricmp.o strnicmp.o
#
# stuff to fake unix system calls
UNIX= access.o alarm.o \
console.o chdir.o chmod.o chown.o close.o closedir.o \
do_lock.o do_stat.o dup.o dup2.o \
execl.o execle.o execp.o execv.o execve.o \
fcntl.o flock.o fork.o fstat.o \
getcwd.o getdtabl.o getegid.o geteuid.o getgid.o getgroup.o \
getitimer.o getloadavg.o getpid.o getppid.o \
getuid.o getrusag.o getwd.o \
inode.o initgroups.o ioctl.o isatty.o isctty.o \
kill.o killpg.o link.o lockf.o lseek.o lstat.o \
mkfifo.o mkdir.o mknod.o \
nice.o open.o opendir.o \
pause.o pipe.o perror.o pgrp.o popen.o psignal.o putenv.o \
read.o readdir.o rewinddi.o rename.o rmdir.o \
sbrk.o seekdir.o select.o \
setegid.o seteuid.o setgid.o \
setrgid.o setruid.o \
setitimer.o setregid.o setreuid.o setuid.o \
sgtty.o sigactio.o \
sigblock.o siglist.o signal.o sleep.o spawn.o spawnve.o spawnvp.o \
setitimer.o setrlimi.o stat.o statfs.o symlink.o sysconf.o \
telldir.o time.o times.o timeoday.o ttyname.o \
uidgid.o uname.o unlink.o unx2dos.o utime.o \
vfork.o \
wait.o wait3.o wait4.o waitpid.o write.o
#
# termios stuff
TERMIOS= cfgetisp.o cfgetosp.o cfsetisp.o cfsetosp.o \
tcattr.o tcbreak.o tcdrain.o \
tcflow.o tcflush.o tcpgrp.o
#
# stuff for integer only scan/printf
IIOBJ = idoprnt.o iscanf.o fprintf.o sprintf.o fscanf.o sscanf.o
$(CLIB): $(GCC) $(UNIX) $(STRING) $(ANSI) $(PORT) $(TERMIOS)
$(AR) rs $(CLIB) $(GCC) $(UNIX) $(STRING) $(ANSI) $(PORT) $(TERMIOS)
$(IIOLIB): $(IIOBJ)
$(AR) rs $(IIOLIB) $(IIOBJ)
#
# gmon.o CANNOT have -fomit-frame-pointer
gmon.o: gmon.c
$(CC) $(CFFLAGS) -c $<
#
# Assembler stuff that needs to be preprocessed
#
.SUFFIXES: .cpp
$(FCOMPD): %.o: _cmpdf2.cpp
$(CC) $(PPFLAGS) -DL$* -x assembler-with-cpp -c $< -o $@
$(FCOMPS): %.o: _cmpsf2.cpp
$(CC) $(PPFLAGS) -DL$* -x assembler-with-cpp -c $< -o $@
.cpp.o:
$(CC) $(PPFLAGS) -x assembler-with-cpp -c $< -o $@
setjmp.o : setjmp.cpp
div.o : div.cpp
_addsubd.o: _addsubd.cpp
_addsubs.o: _addsubs.cpp
_divdf3.o: _divdf3.cpp
_divsf3.o: _divsf3.cpp
_extends.o: _extends.cpp
_fixdfsi.o: _fixdfsi.cpp
_fltsi.o: _fltsi.cpp
_fxunsd.o: _fxunsd.cpp
_muldf3.o: _muldf3.cpp
_mulsf3.o: _mulsf3.cpp
_normdf.o: _normdf.cpp
_normsf.o: _normsf.cpp
_truncdf.o: _truncdf.cpp
_fixsfsi.o: _fixsfsi.cpp
_fltsisf.o: _fltsisf.cpp
frexp.o: frexp.cpp
ldexp.o: ldexp.cpp
modf.o: modf.cpp
vfork.o : vfork.cpp
osbind.o : osbind.cpp
alloca.o: alloca.cpp
bcopy.o: bcopy.cpp
bzero.o: %.o: bzero.cpp
$(CC) $(PPFLAGS) -DL$* -x assembler-with-cpp -c $< -o $@
memset.o: %.o: bzero.cpp
$(CC) $(PPFLAGS) -DL$* -x assembler-with-cpp -c $< -o $@
#
# integer only io stuff
idoprnt.o: doprnt.c
$(CC) $(CFLAGS) -D__NO_FLOAT__ -c $< -o idoprnt.o
iscanf.o: scanf.c
$(CC) $(CFLAGS) -D__NO_FLOAT__ -c $< -o iscanf.o
#
# gcrt0 and crt0
#
$(GCRT0): crt0.cpp
$(CC) $(PPFLAGS) -DGCRT0 -x assembler-with-cpp -c $< -o $@
$(CRT0): crt0.cpp
$(CC) $(PPFLAGS) -x assembler-with-cpp -c $< -o $@
# other dependencies
atof.o : flonum.h
#
# libgcc2 stuff (works for both -mshort and -mnoshort)
$(GLIB2): %.o: libgcc2.c longlong.h
$(CC) $(CLFLAGS) -DL$* -c $< -o $@
clean:
rm -f $(GCC)
rm -f $(UNIX)
rm -f $(STRING)
rm -f $(ANSI)
rm -f $(PORT)
rm -f $(TERMIOS)
rm -f $(IIOBJ)
rm -f $(CLIB) $(IIOLIB) $(CRT0) $(GCRT0)
# Install what we've built
install: all
-$(MKDIR) $(MDFLAGS) $(DESTDIR)
$(INSTALL) $(INFLAGS) $(CLIB) $(DESTDIR)
$(INSTALL) $(INFLAGS) $(IIOLIB) $(DESTDIR)
$(INSTALL) $(INFLAGS) $(CRT0) $(DESTDIR)
$(INSTALL) $(INFLAGS) $(GCRT0) $(DESTDIR)