#
# Makefile - makefile for romcheck
#
# Copyright (C) 1998-2003 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.
#
# $Id: Makefile.in,v 1.6 2003/01/25 23:29:43 gkminix Exp $
#
# Directory names
prefix =
exec_prefix = ${prefix}
bindir = ${exec_prefix}/bin
mandir = ${prefix}/man
libdir = ${exec_prefix}/lib
nblibdir = ${exec_prefix}/lib/netboot
utildir = $(nblibdir)/utils
############# Do not touch anything below this line #####################
CC = cc
BCC =
CPP = cc -E
AS86 = /usr/local/bin/as86
LD86 = /usr/local/bin/ld86
INSTALL = /usr/bin/install -c -o root -g wheel
# define if we have a proper development system
DEV86=no86
# define location of other directories and files within this package
INCDIR = ../../include
BCCINC = $(BCC:%/bin/bcc=%/include)
# compiler and linker flags
INCLUDE = -I. -I$(INCDIR) -I/usr/lib/bcc/include
BCCFLAGS = -0 -Ms $(INCLUDE)
AS86FLAGS = -0 -u -w -j
LD86FLAGS = -0 -d
LINKFLAGS = -0 -X-d -Ms -i-
# list of source and object files
CSRCS = main.c printscan.c printhex.c printinfo.c io.c
ASRCS = loader.S doscan.S
MAINOBJS = main.o doscan.o printscan.o printhex.o printinfo.o io.o
MAINBIN = main.bin
LOADOBJS = loader.o
LOADBIN = loader.bin
TARGET = romcheck.bin
# rules to create object files from source files
.SUFFIXES: .c .S .s .o
.c.o:
$(BCC) $(BCCFLAGS) -c -o $@ $<
.S.s:
$(CPP) $(INCLUDE) -o $@ $<
.s.o:
$(AS86) $(AS86FLAGS) -o $@ $< || { rm -f $@ && false; }
.S.o:
$(CPP) $(INCLUDE) -o $(<:.S=.s) $<
$(AS86) $(AS86FLAGS) -o $@ $(<:.S=.s) || { rm -f $@ && false; }
.PHONY: all distrib install dep
all distrib: $(TARGET)-$(DEV86)
$(TARGET)-no86:
@touch $(TARGET)
$(TARGET)-i86: $(TARGET)
$(TARGET): $(LOADBIN) $(MAINBIN)
cat $(LOADBIN) $(MAINBIN) > $(TARGET)
@chmod 644 $(TARGET)
$(LOADBIN): stamp-version $(LOADOBJS)
$(LD86) $(LD86FLAGS) -o $(LOADBIN) $(LOADOBJS)
@chmod 644 $(LOADBIN)
$(MAINBIN): stamp-version $(MAINOBJS)
$(BCC) $(LINKFLAGS) -o $(MAINBIN) $(MAINOBJS)
@chmod 644 $(MAINBIN)
stamp-version:
(cd $(INCDIR) && $(MAKE) version.h) || exit 1
@touch stamp-version
install: all
$(INSTALL) -o bin -g bin -d $(utildir)
$(INSTALL) -m 644 -o bin -g bin $(TARGET) $(utildir)/$(TARGET)
dep: stamp-version
sed '/\#\#\# Dependencies/q' <Makefile >tmp_make
if test "x$(BCCINC)" = "x"; then \
$(CPP) $(INCLUDE) -MM $(CSRCS) >>tmp_make; \
else \
$(CPP) $(INCLUDE) -MM $(CSRCS) -I$(BCCINC) >>tmp_make; \
fi
$(CPP) $(INCLUDE) -MM $(ASRCS) >>tmp_make
mv tmp_make Makefile
.PHONY: clean distclean realclean
clean:
rm -f *.o *.s *.b *.lst *.map *.bak tmp_make core
rm -f stamp-*
rm -f $(LOADBIN) $(MAINBIN)
distclean: clean
rm -f Makefile
rm -f *.o *.s *.b *.lst *.map *.bak
realclean: distclean
rm -f $(TARGET)
### Dependencies
syntax highlighted by Code2HTML, v. 0.9.1