propagator/Makefile

155 lines
3.4 KiB
Makefile
Raw Normal View History

2004-11-22 13:47:29 +00:00
PACKAGE = propagator
2004-01-20 18:32:43 +00:00
2004-11-22 13:47:29 +00:00
DESTDIR =
2004-12-06 19:55:19 +00:00
2004-12-17 23:38:21 +00:00
BINDIR ?= /usr/bin
LIBDIR ?= /usr/lib
BINSDIR ?= $(LIBDIR)/$(PACKAGE)/bin
2004-12-07 16:08:11 +00:00
INSTALL = /usr/bin/install
TARGETS = init stage1 gencpio
2004-01-20 18:32:43 +00:00
all: version.h $(TARGETS)
#---------------------------------------------------------------
L ?= GLIBC
#L = KLIBC
ifeq ($(L),KLIBC)
CC = klcc
endif
ifeq ($(F),)
ifeq ($(L),GLIBC)
F = NEWT
else
F = STDIO
endif
endif
CFLAGS += -Os -pipe -Wall
2005-08-05 13:33:39 +00:00
GLIBC_INCLUDES =
KLIBC_INCLUDES =
INCLUDES = $($(L)_INCLUDES)
GCC_LIBDIR=$(shell dirname `gcc -print-libgcc-file-name`)
LIBGCC_A=$(shell gcc -print-libgcc-file-name)
GLIBC_LDFLAGS_STAGE1 = -static
KLIBC_LDFLAGS_STAGE1 =
# $(LIBGCC_A)
LDFLAGS_STAGE1 = $($(L)_LDFLAGS_STAGE1)
GLIBC_LIBC =
KLIBC_LIBC =
STAGE1_LIBC = $($(L)_LIBC)
STRIPCMD = strip -R .note -R .comment
#---------------------------------------------------------------
DEFS = -D_GNU_SOURCE
INIT_DEFS =
STAGE1_DEFS =
2004-12-06 19:55:19 +00:00
ifneq ($(WITH_SHELL),)
STAGE1_DEFS += -DSPAWN_SHELL
2004-12-06 19:55:19 +00:00
endif
ifneq ($(WITH_SPLASH),)
STAGE1_DEFS += -DSPAWN_SPLASH
endif
2005-02-28 19:26:48 +00:00
ifeq ($(WITH_ADSL),)
STAGE1_DEFS += -DDISABLE_ADSL
endif
ifneq ($(WITHOUT_USBNET),)
STAGE1_DEFS += -DDISABLE_USBNET
2005-02-28 19:26:48 +00:00
endif
2004-12-06 19:55:19 +00:00
COMPILE = $(CC) $(CFLAGS) $(DEFS)
2004-01-20 18:32:43 +00:00
2004-11-22 13:47:29 +00:00
#- stage1 "loader"
# i386 name is invalid to force this feature off
2004-01-20 18:32:43 +00:00
INITSRC = init.c
INIT_DEFS = $(INCLUDES)
2004-01-20 18:32:43 +00:00
INITOBJS = $(addprefix $(L)-,$(subst .c,.o,$(INITSRC)))
2004-01-20 18:32:43 +00:00
2004-11-22 13:47:29 +00:00
#- frontends
2004-01-20 18:32:43 +00:00
NEWT_FRONTEND_SRC = newt-frontend.c
NEWT_FRONTEND_LIBS = $(LIBDIR)/libnewt.a $(LIBDIR)/libslang.a
2004-01-20 18:32:43 +00:00
STDIO_FRONTEND_SRC = stdio-frontend.c
STDIO_FRONTEND_LIBS =
2004-01-20 18:32:43 +00:00
FRONTEND_OBJS = $(addprefix $(L)-,$(subst .c,.o,$($(F)_FRONTEND_SRC)))
FRONTEND_LINK = $(FRONTEND_OBJS) $($(F)_FRONTEND_LIBS)
2004-01-20 18:32:43 +00:00
GLIBC_STAGE1_OWN_LIBS =
KLIBC_STAGE1_OWN_LIBS =
2004-01-20 18:32:43 +00:00
STAGE1_OWN_LIBS = $($(L)_STAGE1_OWN_LIBS)
ifeq ($(L),KLIBC)
STAGE1_NETWORK_LIBS =
2004-01-20 18:32:43 +00:00
endif
ifeq ($(L),GLIBC)
2007-03-16 15:08:50 +03:00
STAGE1_NETWORK_LIBS = $(LIBDIR)/libresolv.a
2004-01-20 18:32:43 +00:00
endif
2004-11-22 13:47:29 +00: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 13:47:29 +00:00
###############################################################################
2004-01-20 18:32:43 +00:00
STAGE1OBJS = $(addprefix $(L)-,$(subst .c,.o,$(STAGE1SRC)))
2004-01-20 18:32:43 +00:00
LDFLAGS_INIT = $($(L)_LDFLAGS_STAGE1)
INIT_LIBC = $($(L)_LIBC)
2004-01-20 18:32:43 +00:00
init: $(INITOBJS) $(INIT_LIBC)
2004-01-20 18:32:43 +00:00
$(CC) -o $@ $^ $(LDFLAGS_INIT)
$(STRIPCMD) $@
stage1: $(STAGE1OBJS) $(STAGE1_OWN_LIBS) $(STAGE1_NETWORK_LIBS) $(FRONTEND_LINK) $(STAGE1_LIBC)
2004-01-20 18:32:43 +00:00
$(CC) -o $@ $^ $(LDFLAGS_STAGE1)
$(STRIPCMD) $@
$(INITOBJS): $(L)-%.o: %.c
$(COMPILE) $(INIT_DEFS) -c $< -o $@
2004-01-20 18:32:43 +00:00
$(STAGE1OBJS): $(L)-%.o: %.c
$(COMPILE) $(INCLUDES) $(STAGE1_DEFS) -c $< -o $@
$(FRONTEND_OBJS): $(L)-%.o: %.c
$(COMPILE) $(INCLUDES) -c $< -o $@
2004-01-20 18:32:43 +00:00
2004-11-22 13:47:29 +00: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 18:32:43 +00:00
gencpio: gen_init_cpio.c
$(CC) $(CFLAGS) $(DEFS) -o $@ $^
initfs: mkinitfs $(TARGETS)
sh $< $@
install: initfs
$(INSTALL) -D -m0755 gencpio $(DESTDIR)$(BINDIR)/gencpio
$(INSTALL) -m0755 mkmodpack $(DESTDIR)$(BINDIR)/mkmodpack
$(INSTALL) -D -m0644 initfs $(DESTDIR)$(LIBDIR)/$(PACKAGE)/initfs
2004-01-20 18:32:43 +00:00
clean:
rm -f *.o .depend $(TARGETS) version.h
2004-01-20 18:32:43 +00:00
.depend:
$(CPP) $(CFLAGS) -M $(ALLSRC) > .depend
ifeq (.depend,$(wildcard .depend))
include .depend
endif