1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
|
#
# Makefile - makefile for mknbi program for DOS
#
# Copyright (C) 1996-1998 Gero Kuhlmann <gero@gkminix.han.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# Directory names
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
mandir = @mandir@
libdir = @libdir@
utildir = $(libdir)/utils
# MANEXT is the manual section number
MANEXT = 8
# ADEBUG define the flags for compiling the boot loader with the
# debugging code enabled:
# ASM_DEBUG -- enable debugging output while loading and
# initializing DOS and the ramdisk image.
# DRV_DEBUG -- enable debugging output when accessing the
# ramdisk driver under DOS.
# ASM_FREEZE_AFTER_INIT -- freeze the system after successful initiali-
# zation; this is right before the actual kernel
# is launched. Enable this flag for debugging
# purposes only!
ADEBUG = # -DASM_DEBUG -DDRV_DEBUG -DASM_FREEZE_AFTER_INIT
############# Do not touch anything below this line #####################
CC = @CC@
BCC = @BCC@
CPP = @CPP@
AS86 = @AS86@
LD86 = @LD86@
INSTALL = @INSTALL@
@SET_MAKE@
# define location of other directories and files within this package
INCDIR = ../include
MISCDIR = ../misc
LIBDIR = ../nblib
MAKEC = $(MISCDIR)/makec
CDEBUG = @CFLAGS@ # -g
INCLUDE = -I. -I.. -I$(INCDIR)
CFLAGS = $(CDEBUG) @DEFS@ $(INCLUDE)
LDFLAGS = -s
LIBS = -L$(LIBDIR) -lnb @LIBS@
DEV86 = @DEV86@
SRCS = mknbi.c openrd.c boot_c.c first_c.c
OBJS = mknbi.o openrd.o first_c.o boot_c.o
TARGET = mknbi-dos
.PHONY: all distrib install dep
all: $(TARGET) rmrd.com
$(TARGET): mknbi
mknbi: stamp-version first_c.c boot_c.c $(OBJS)
(cd $(LIBDIR) && $(MAKE) all) || exit 1
$(CC) -o mknbi $(LDFLAGS) $(OBJS) $(LIBS)
# generate C source file from boot image loader binary source
first_c.c: stamp-first-$(DEV86)
stamp-first-i86: first.S first.inc stamp-version stamp-makec
$(CPP) $(ADEBUG) $(INCLUDE) first.S -o first.s
$(AS86) -0 -b first.b first.s
$(MAKEC) first <first.b >first_c.c
@rm -f first.s first.b
@touch stamp-first-i86
stamp-first-no86:
@touch first_c.c
@touch stamp-first-no86
# generate C source file from boot sector binary source
boot_c.c: stamp-boot-$(DEV86)
stamp-boot-i86: boot.S boot.inc stamp-makec
$(CPP) $(ADEBUG) boot.S -o boot.s
$(AS86) -0 -b boot.b -s boot.map boot.s
$(MAKEC) boot <boot.b >boot_c.c
@rm -f boot.s boot.b boot.map
@touch stamp-boot-i86
stamp-boot-no86:
@touch boot_c.c
@touch stamp-boot-no86
# generate utility to remove a loaded ramdisk
rmrd.com: stamp-rmrd-$(DEV86)
stamp-rmrd-i86: rmrd.S
$(CPP) rmrd.S -o rmrd.s
$(AS86) -0 -b rmrd.com -s rmrd.map rmrd.s
@rm -f rmrd.s rmrd.map
@touch stamp-rmrd-i86
stamp-rmrd-no86:
@touch rmrd.com
@touch stamp-rmrd-no86
# generate various required files which can be found in other directories
stamp-version:
(cd $(INCDIR) && $(MAKE) version.h) || exit 1
@touch stamp-version
stamp-makec:
(cd $(MISCDIR) && $(MAKE) makec) || exit 1
@touch stamp-makec
# distrib generates all files which are not removed by distclean
distrib: stamp-first-i86 stamp-boot-i86 stamp-rmrd-i86
install: all
$(INSTALL) -d $(bindir)
$(INSTALL) -d $(mandir)/man$(MANEXT)
$(INSTALL) -o bin -g bin -d $(libdir)
$(INSTALL) -o bin -g bin -d $(utildir)
$(INSTALL) -m 511 mknbi $(bindir)/$(TARGET)
$(INSTALL) -m 644 -o bin -g bin rmrd.com $(utildir)/rmrd.com
$(INSTALL) -m 644 -o bin -g bin mknbi.man $(mandir)/man$(MANEXT)/$(TARGET).$(MANEXT)
dep: stamp-version
sed '/\#\#\# Dependencies/q' <Makefile >tmp_make
$(CPP) $(CFLAGS) -MM $(SRCS) >>tmp_make
mv tmp_make Makefile
.PHONY: clean distclean realclean
clean:
rm -f *.o *.s *.b *.map mknbi tmp_make core
rm -f stamp-*
distclean: clean
rm -f Makefile
realclean: distclean
rm -f first_c.c boot_c.c rmrd.com
### Dependencies
|