propagator/Makefile

172 lines
4.1 KiB
Makefile
Raw Normal View History

2004-01-20 21:32:43 +03:00
#******************************************************************************
#
# mdk-stage1 - the program that will load second-stage install
#
# $Id$
#
# Guillaume Cottenceau (gc@mandrakesoft.com)
#
# Copyright 2000 MandrakeSoft
#
# This software may be freely redistributed under the terms of the GNU
# public license.
#
# 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.
#
# Portions from Erik Troan (ewt@redhat.com) Copyright 1996 Red Hat Software
#
#*****************************************************************************
#
# Currently:
#
# ix86
# init with minilibc
# stage1 with dietlibc except some targets
#
# ppc
# init with dietlibc
# stage1 with glibc
#
# ia64
# init with glibc
# stage1 with glibc
#
#*****************************************************************************
2004-11-22 16:47:29 +03:00
PACKAGE = propagator
2004-01-20 21:32:43 +03:00
2004-11-22 16:47:29 +03:00
DESTDIR =
2004-12-06 22:55:19 +03:00
2004-12-18 02:38:21 +03:00
BINDIR ?= /usr/bin
LIBDIR ?= /usr/lib
BINSDIR ?= $(LIBDIR)/$(PACKAGE)/bin
2004-12-07 19:08:11 +03:00
TARGETS = init stage1 gencpio
2004-01-20 21:32:43 +03:00
all: version.h $(TARGETS)
2005-08-05 17:33:39 +04:00
include Makefile.common
DEFS =
INIT_DEFS =
STAGE1_DEFS =
2004-12-06 22:55:19 +03:00
ifneq ($(WITH_SHELL),)
STAGE1_DEFS += -DSPAWN_SHELL
2004-12-06 22:55:19 +03:00
endif
2005-02-28 22:26:48 +03:00
ifeq ($(WITH_ADSL),)
STAGE1_DEFS += -DDISABLE_ADSL
endif
ifneq ($(WITHOUT_USBNET),)
STAGE1_DEFS += -DDISABLE_USBNET
2005-02-28 22:26:48 +03:00
endif
2004-12-06 22:55:19 +03:00
2004-01-20 21:32:43 +03:00
COMPILE = $(CC) $(DEFS) $(CFLAGS)
2004-11-22 16:47:29 +03:00
#- stage1 "loader"
# i386 name is invalid to force this feature off
2004-03-10 19:54:55 +03:00
ifeq (xi386, $(ARCH))
2004-01-20 21:32:43 +03:00
INITSRC = minilibc.c init.c
INIT_DEFS = -DINIT_HEADERS=\"minilibc.h\"
else
INITSRC = init.c
ifeq (ia64, $(ARCH))
INIT_DEFS = -DINIT_HEADERS=\"init-libc-headers.h\" $(GLIBC_INCLUDES)
else
INIT_DEFS = -DINIT_HEADERS=\"init-libc-headers.h\" $(DIETLIBC_INCLUDES)
endif
endif
INITOBJS = $(subst .c,.o,$(INITSRC))
2004-11-22 16:47:29 +03:00
#- frontends
2004-01-20 21:32:43 +03:00
NEWT_FRONTEND_SRC = newt-frontend.c
2007-02-27 16:54:57 +03:00
GLIBC_NEWT_FRONTEND_LIBS = $(LIBDIR)/libnewt.a $(LIBDIR)/libslang.a
2004-11-22 16:47:29 +03:00
DIETLIBC_NEWT_FRONTEND_LIBS = $(DIET_LIBDIR)/libnewt.a $(DIET_LIBDIR)/libslang.a
2004-01-20 21:32:43 +03:00
STDIO_FRONTEND_SRC = stdio-frontend.c
GLIBC_STDIO_FRONTEND_LIBS =
DIETLIBC_STDIO_FRONTEND_LIBS =
FRONTEND_OBJS = $(subst .c,.o,$($(F)_FRONTEND_SRC))
FRONTEND_LINK = $(FRONTEND_OBJS) $($(L)_$(F)_FRONTEND_LIBS)
2007-02-27 16:54:57 +03:00
GLIBC_STAGE1_OWN_LIBS = $(LIBDIR)/libmar.a $(LIBDIR)/libbz2.a
2004-11-22 16:47:29 +03:00
DIETLIBC_STAGE1_OWN_LIBS = $(DIET_LIBDIR)/libmar.a $(DIET_LIBDIR)/libbz2.a
2004-01-20 21:32:43 +03:00
STAGE1_OWN_LIBS = $($(L)_STAGE1_OWN_LIBS)
ifeq (DIETLIBC, $(L))
2004-11-22 16:47:29 +03:00
STAGE1_NETWORK_LIBS = $(DIET_LIBDIR)/librpc.a
2004-01-20 21:32:43 +03:00
endif
ifeq (GLIBC, $(L))
STAGE1_NETWORK_LIBS = /usr/lib/libresolv.a
endif
2004-11-22 16:47:29 +03:00
###############################################################################
# stage1 itself
STAGE1SRC = stage1.c log.c tools.c modules.c probing.c \
mount.c lomount.c automatic.c frontend-common.c \
cdrom.c disk.c \
network.c nfsmount.c dhcp.c url.c dns.c adsl.c
ALLSRC = $(INITSRC) $(STAGE1SRC)
2004-11-22 16:47:29 +03:00
###############################################################################
2004-01-20 21:32:43 +03:00
STAGE1OBJS = $(subst .c,.o,$(STAGE1SRC))
2004-01-20 21:32:43 +03:00
2004-03-10 19:54:55 +03:00
ifeq (xi386, $(ARCH))
2004-01-20 21:32:43 +03:00
LDFLAGS_INIT = -static -nostdlib /usr/lib/crt1.o
else
ifeq (ia64, $(ARCH))
LDFLAGS_INIT = $(GLIBC_LDFLAGS_STAGE1)
INIT_LIBC = $(GLIBC_LIBC)
else
2007-02-27 16:54:57 +03:00
LDFLAGS_INIT = $(GLIBC_LDFLAGS_STAGE1)
INIT_LIBC = $(GLIBC_LIBC)
2004-01-20 21:32:43 +03:00
endif
endif
2004-11-22 16:47:29 +03:00
init: $(INITOBJS) $(INIT_LIBC)
2004-01-20 21:32:43 +03:00
$(CC) -o $@ $^ $(LDFLAGS_INIT)
$(STRIPCMD) $@
stage1: $(STAGE1OBJS) $(STAGE1_OWN_LIBS) $(STAGE1_NETWORK_LIBS) $(FRONTEND_LINK) $(STAGE1_LIBC)
2004-01-20 21:32:43 +03:00
$(CC) -o $@ $^ $(LDFLAGS_STAGE1)
$(STRIPCMD) $@
$(INITOBJS): %.o: %.c
$(COMPILE) $(INIT_DEFS) -c $<
$(STAGE1OBJS): %.o: %.c
$(COMPILE) $(INCLUDES) $(STAGE1_DEFS) -c $< -o $@
2004-01-20 21:32:43 +03:00
.c.o:
$(COMPILE) $(INCLUDES) -c $<
2004-11-22 16:47:29 +03:00
version.h: /etc/altlinux-release
@sed 's|^ALT Linux \([^ ]\+\)\([^(]\+\)(\([^)]\+\))|\
echo \\#define VERSION \\"\2\\";echo \\#define DISTRIB_NAME \\"ALT Linux\2\1 \\(\3\\)\\"|' < $^ |sh > $@
2004-01-20 21:32:43 +03:00
clean:
rm -f *.o .depend $(TARGETS) version.h
2004-01-20 21:32:43 +03:00
.depend:
$(CPP) $(CFLAGS) -M $(ALLSRC) > .depend
ifeq (.depend,$(wildcard .depend))
include .depend
endif
2004-12-18 02:38:21 +03:00
gencpio: gen_init_cpio.c
gcc -Wall -O2 $^ -o $@
2004-12-18 02:38:21 +03:00
install: $(TARGETS)
2004-12-18 02:38:21 +03:00
mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(BINSDIR)
install -m0755 gencpio $(DESTDIR)$(BINDIR)
install -m0755 init stage1 $(DESTDIR)$(BINSDIR)