summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Badaire <mbadaire@mandriva.com>2001-05-30 14:31:23 +0000
committerMatthias Badaire <mbadaire@mandriva.com>2001-05-30 14:31:23 +0000
commit0879c2dadfe9f6998bdcddf837918ed8617d17b4 (patch)
tree29d89b91ab9935e390efcf1739a7867b8ea2d8c3
parentd8b95b8592b512c3bc036cb2df9745e39104490d (diff)
downloaddrakx-0879c2dadfe9f6998bdcddf837918ed8617d17b4.tar
drakx-0879c2dadfe9f6998bdcddf837918ed8617d17b4.tar.gz
drakx-0879c2dadfe9f6998bdcddf837918ed8617d17b4.tar.bz2
drakx-0879c2dadfe9f6998bdcddf837918ed8617d17b4.tar.xz
drakx-0879c2dadfe9f6998bdcddf837918ed8617d17b4.zip
- allow build on ia64
- have CFLAGS centralized in Makefile.common (should help ports such as alpha) - better looking sub makefiles
-rw-r--r--mdk-stage1/Makefile34
-rw-r--r--mdk-stage1/Makefile.common11
-rw-r--r--mdk-stage1/bzlib/Makefile32
-rw-r--r--mdk-stage1/init-libc-headers.h4
-rw-r--r--mdk-stage1/insmod-modutils/Makefile10
-rw-r--r--mdk-stage1/insmod-modutils/obj/Makefile6
-rw-r--r--mdk-stage1/insmod-modutils/util/Makefile9
-rw-r--r--mdk-stage1/mar/Makefile20
-rw-r--r--mdk-stage1/newt/Makefile29
-rw-r--r--mdk-stage1/newt/windows.c2
-rw-r--r--mdk-stage1/slang/Makefile30
-rw-r--r--mdk-stage1/slang/slmalloc.c6
-rw-r--r--mdk-stage1/stage1.c1
13 files changed, 133 insertions, 61 deletions
diff --git a/mdk-stage1/Makefile b/mdk-stage1/Makefile
index 75857a408..7f43acf06 100644
--- a/mdk-stage1/Makefile
+++ b/mdk-stage1/Makefile
@@ -18,6 +18,23 @@
# 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
+ #
+ #*****************************************************************************
+
VERSION = cooker
@@ -26,8 +43,6 @@ top_dir = .
include $(top_dir)/Makefile.common
-CFLAGS = -Os -pipe -Wall -Werror -fomit-frame-pointer
-
DEFS = -DVERSION=\"$(VERSION)\" -DSPAWN_SHELL
COMPILE = $(CC) $(DEFS) $(CFLAGS)
@@ -39,8 +54,12 @@ 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))
@@ -108,9 +127,14 @@ NETWORK_DEFS = -DDISABLE_CDROM -DDISABLE_DISK
ifeq (i386, $(ARCH))
LDFLAGS_INIT = -static -nostdlib /usr/lib/crt1.o
else
+ifeq (ia64, $(ARCH))
+LDFLAGS_INIT = $(GLIBC_LDFLAGS_STAGE1)
+INIT_LIBC = $(GLIBC_LIBC)
+else
LDFLAGS_INIT = $(DIETLIBC_LDFLAGS_STAGE1)
INIT_LIBC = $(DIETLIBC_LIBC)
endif
+endif
BINS = init stage1-full
@@ -119,8 +143,10 @@ ifeq (i386, $(ARCH))
BINS += stage1-cdrom stage1-disk stage1-network
endif
-
-DIRS = dietlibc mar pci-resource bzlib $(INSMOD) slang newt
+ifneq (ia64, $(ARCH))
+DIRS = dietlibc
+endif
+DIRS += mar pci-resource bzlib $(INSMOD) slang newt
ifeq (i386,$(ARCH))
DIRS += pcmcia
endif
diff --git a/mdk-stage1/Makefile.common b/mdk-stage1/Makefile.common
index d4aae4bac..58b43bcd7 100644
--- a/mdk-stage1/Makefile.common
+++ b/mdk-stage1/Makefile.common
@@ -19,12 +19,21 @@ ARCH := $(patsubst sparc%,sparc,$(ARCH))
#- default lib is dietlibc (honoured by main Makefile whenever possible)
L = DIETLIBC
-# L = GLIBC
+#L = GLIBC
#- default frontend is newt (honoured by main Makefile whenever possible)
F = NEWT
# F = STDIO
+ #- override in some situations
+ifeq (ia64, $(ARCH))
+L = GLIBC
+endif
+
+
+ #- flags used by all stuff
+CFLAGS = -Os -pipe -Wall -Werror -fomit-frame-pointer
+
DIETLIBC_INCLUDES = -I$(top_dir)/dietlibc/include -I.
GLIBC_INCLUDES = -I.
diff --git a/mdk-stage1/bzlib/Makefile b/mdk-stage1/bzlib/Makefile
index 3015ccc2d..6b4f29ffc 100644
--- a/mdk-stage1/bzlib/Makefile
+++ b/mdk-stage1/bzlib/Makefile
@@ -18,30 +18,38 @@ top_dir = ..
include $(top_dir)/Makefile.common
-all: libbzlib.a libbzlib-DIET.a
+LIBNAME = libbzlib
-clean:
- rm -f *.o *.a
+OBJS = blocksort.o bzlib.o compress.o crctable.o decompress.o huffman.o randtable.o
-FLAGS = -Wall -Werror -Os -fomit-frame-pointer -c
+DEFS =
+INCS =
-OBJS = blocksort.o bzlib.o compress.o crctable.o decompress.o huffman.o randtable.o
-OBJS-DIET = $(subst .o,-DIET.o,$(OBJS))
+TARGETS = $(LIBNAME).a
+
+ifeq (DIETLIBC, $(L))
+TARGETS += $(LIBNAME)-DIET.a
+endif
+
+all: $(TARGETS)
-libbzlib.a: $(OBJS)
+clean:
+ rm -f *.o *.a
+
+OBJS-DIET = $(subst .o,-DIET.o,$(OBJS))
+
+$(LIBNAME).a: $(OBJS)
ar -cru $@ $^
ranlib $@
-libbzlib-DIET.a: $(OBJS-DIET)
+$(LIBNAME)-DIET.a: $(OBJS-DIET)
ar -cru $@ $^
ranlib $@
-
$(OBJS): %.o: %.c
- gcc $(FLAGS) $(GLIBC_INCLUDES) -c $< -o $@
+ gcc $(CFLAGS) $(DEFS) $(INCS) $(GLIBC_INCLUDES) -c $< -o $@
$(OBJS-DIET): %-DIET.o: %.c
- gcc $(FLAGS) $(DIETLIBC_INCLUDES) -c $< -o $@
-
+ gcc $(CFLAGS) $(DEFS) $(INCS) $(DIETLIBC_INCLUDES) -c $< -o $@
diff --git a/mdk-stage1/init-libc-headers.h b/mdk-stage1/init-libc-headers.h
index f5f6aa2e6..01761e869 100644
--- a/mdk-stage1/init-libc-headers.h
+++ b/mdk-stage1/init-libc-headers.h
@@ -40,5 +40,5 @@
#define SOCK_STREAM 1
#endif
-_syscall3(int, syslog, int, type, char *, bufp, int, len);
-_syscall3(int, reboot, int, magic, int, magic2, int, flag);
+static inline _syscall3(int, syslog, int, type, char *, bufp, int, len);
+static inline _syscall3(int, reboot, int, magic, int, magic2, int, flag);
diff --git a/mdk-stage1/insmod-modutils/Makefile b/mdk-stage1/insmod-modutils/Makefile
index 74ebdeafb..e8f78d2d0 100644
--- a/mdk-stage1/insmod-modutils/Makefile
+++ b/mdk-stage1/insmod-modutils/Makefile
@@ -13,7 +13,9 @@ top_dir = ..
include $(top_dir)/Makefile.common
-FLAGS = -c -Wall -Os -fomit-frame-pointer -I./include -D_GNU_SOURCE -DELF_MACHINE_H='"elf_$(ARCH).h"' -DARCH_$(ARCH)
+INCS = -I./include
+
+DEFS = -Wno-error -D_GNU_SOURCE -DELF_MACHINE_H='"elf_$(ARCH).h"' -DARCH_$(ARCH)
DIRS = util obj
@@ -51,11 +53,11 @@ libinsmod-DIET.a: insmod-DIET.o ./util/libutil-DIET.a ./obj/libobj-DIET.a
ranlib $@
insmod-frontend.o: insmod-frontend.c insmod.c
- gcc $(FLAGS) $(GLIBC_INCLUDES) insmod-frontend.c
+ gcc $(CFLAGS) $(DEFS) $(INCS) $(GLIBC_INCLUDES) -c insmod-frontend.c
insmod.o: insmod.c
- gcc $(FLAGS) $(GLIBC_INCLUDES) insmod.c
+ gcc $(CFLAGS) $(DEFS) $(INCS) $(GLIBC_INCLUDES) -c insmod.c
insmod-DIET.o: insmod.c
- gcc $(FLAGS) $(DIETLIBC_INCLUDES) -o $@ insmod.c
+ gcc $(CFLAGS) $(DEFS) $(INCS) $(DIETLIBC_INCLUDES) -o $@ -c insmod.c
diff --git a/mdk-stage1/insmod-modutils/obj/Makefile b/mdk-stage1/insmod-modutils/obj/Makefile
index 9bcf8bac8..34b5df2d9 100644
--- a/mdk-stage1/insmod-modutils/obj/Makefile
+++ b/mdk-stage1/insmod-modutils/obj/Makefile
@@ -19,7 +19,9 @@ clean:
rm -f *.o *.a
-FLAGS = -c -Wall -Os -fomit-frame-pointer -I./../include -D_GNU_SOURCE -DELF_MACHINE_H='"elf_$(ARCH).h"' -DARCH_$(ARCH) -DCONFIG_ROOT_CHECK_OFF=0
+INCS = -I./../include
+
+DEFS = -D_GNU_SOURCE -DELF_MACHINE_H='"elf_$(ARCH).h"' -DARCH_$(ARCH) -DCONFIG_ROOT_CHECK_OFF=0
OBJS = obj_kallsyms.o obj_common.o obj_load.o obj_reloc.o obj_$(ARCH).o
@@ -28,4 +30,4 @@ libobj.a: $(OBJS)
ranlib $@
.c.o:
- gcc $(FLAGS) $(GLIBC_INCLUDES) -c $<
+ gcc $(CFLAGS) $(DEFS) $(INCS) $(GLIBC_INCLUDES) -c $<
diff --git a/mdk-stage1/insmod-modutils/util/Makefile b/mdk-stage1/insmod-modutils/util/Makefile
index 844f8c0dc..763f046f2 100644
--- a/mdk-stage1/insmod-modutils/util/Makefile
+++ b/mdk-stage1/insmod-modutils/util/Makefile
@@ -19,7 +19,10 @@ clean:
rm -f *.o *.a
-FLAGS = -c -Wall -Os -fomit-frame-pointer -I./../include -D_GNU_SOURCE -DELF_MACHINE_H='"elf_$(ARCH).h"' -DARCH_$(ARCH) -DHAVE_WORDEXP=1 -DHAVE_GLOB=1 -DCONFIG_ROOT_CHECK_OFF=0
+INCS = -I./../include
+
+DEFS = -Wno-error -D_GNU_SOURCE -DELF_MACHINE_H='"elf_$(ARCH).h"' -DARCH_$(ARCH) -DHAVE_WORDEXP=1 -DHAVE_GLOB=1 -DCONFIG_ROOT_CHECK_OFF=0
+
OBJS = xmalloc.o xrealloc.o xstrcat.o xstrdup.o xsystem.o xftw.o \
modstat.o meta_expand.o config.o snap_shot.o arch64.o gzfiles.o sys_nim.o sys_oim.o
@@ -33,7 +36,7 @@ libutil-STANDALONE.a: $(OBJS) logger-standalone.o
ranlib $@
logger-standalone.o: logger.c
- gcc $(FLAGS) $(GLIBC_INCLUDES) -o $@ -D_STANDALONE_ logger.c
+ gcc $(CFLAGS) $(DEFS) $(INCS) $(GLIBC_INCLUDES) -o $@ -D_STANDALONE_ -c logger.c
.c.o:
- gcc $(FLAGS) $(GLIBC_INCLUDES) -c $<
+ gcc $(CFLAGS) $(DEFS) $(INCS) $(GLIBC_INCLUDES) -c $<
diff --git a/mdk-stage1/mar/Makefile b/mdk-stage1/mar/Makefile
index dc5316a1a..801785947 100644
--- a/mdk-stage1/mar/Makefile
+++ b/mdk-stage1/mar/Makefile
@@ -22,13 +22,19 @@ top_dir = ..
include $(top_dir)/Makefile.common
-all: libmar.a libmar-DIET.a mar
+TARGETS = libmar.a mar
+
+
+ifeq (DIETLIBC, $(L))
+TARGETS += libmar-DIET.a
+endif
+
+
+all: $(TARGETS)
clean:
rm -f *.o libmar.a libmar-DIET.a mar
-FLAGS = -Wall -Werror -Os -fomit-frame-pointer -c
-
mar: mar-frontend.o mar-extract-only-standalone.o
gcc -o mar mar-frontend.o mar-extract-only-standalone.o -lbz2
@@ -43,13 +49,13 @@ libmar-DIET.a: mar-extract-only-DIET.o
ranlib $@
mar-extract-only.o: mar-extract-only.c mar-extract-only.h mar.h
- gcc $(FLAGS) $(GLIBC_INCLUDES) mar-extract-only.c
+ gcc $(CFLAGS) $(GLIBC_INCLUDES) -c mar-extract-only.c
mar-extract-only-DIET.o: mar-extract-only.c mar-extract-only.h mar.h
- gcc $(FLAGS) $(DIETLIBC_INCLUDES) -o $@ mar-extract-only.c
+ gcc $(CFLAGS) $(DIETLIBC_INCLUDES) -o $@ -c mar-extract-only.c
mar-frontend.o: mar-frontend.c mar.h mar-extract-only.h
- gcc $(FLAGS) $(GLIBC_INCLUDES) mar-frontend.c
+ gcc $(CFLAGS) $(GLIBC_INCLUDES) -c mar-frontend.c
mar-extract-only-standalone.o: mar-extract-only.c mar-extract-only.h mar.h
- gcc $(FLAGS) $(GLIBC_INCLUDES) -o $@ -D_STANDALONE_ mar-extract-only.c
+ gcc $(CFLAGS) $(GLIBC_INCLUDES) -o $@ -D_STANDALONE_ -c mar-extract-only.c
diff --git a/mdk-stage1/newt/Makefile b/mdk-stage1/newt/Makefile
index c4e6a7207..171bcf0cb 100644
--- a/mdk-stage1/newt/Makefile
+++ b/mdk-stage1/newt/Makefile
@@ -18,32 +18,39 @@ top_dir = ..
include $(top_dir)/Makefile.common
-all: libnewt.a libnewt-DIET.a
+LIBNAME = libnewt
-clean:
- rm -f *.o *.a
+OBJS = newt.o button.o form.o checkbox.o entry.o label.o listbox.o scrollbar.o textbox.o scale.o grid.o windows.o buttonbar.o checkboxtree.o
-FLAGS = -Wall -Werror -Os -fomit-frame-pointer -DVERSION=\"0.50.19\" -c
+DEFS = -DVERSION=\"0.50.19\"
INCS = -I../slang
-OBJS = newt.o button.o form.o checkbox.o entry.o label.o listbox.o scrollbar.o textbox.o scale.o grid.o windows.o buttonbar.o checkboxtree.o
-OBJS-DIET = $(subst .o,-DIET.o,$(OBJS))
+TARGETS = $(LIBNAME).a
+
+ifeq (DIETLIBC, $(L))
+TARGETS += $(LIBNAME)-DIET.a
+endif
+all: $(TARGETS)
-libnewt.a: $(OBJS)
+clean:
+ rm -f *.o *.a
+
+OBJS-DIET = $(subst .o,-DIET.o,$(OBJS))
+
+$(LIBNAME).a: $(OBJS)
ar -cru $@ $^
ranlib $@
-libnewt-DIET.a: $(OBJS-DIET)
+$(LIBNAME)-DIET.a: $(OBJS-DIET)
ar -cru $@ $^
ranlib $@
-
$(OBJS): %.o: %.c
- gcc $(FLAGS) $(GLIBC_INCLUDES) $(INCS) -c $< -o $@
+ gcc $(CFLAGS) $(DEFS) $(INCS) $(GLIBC_INCLUDES) -c $< -o $@
$(OBJS-DIET): %-DIET.o: %.c
- gcc $(FLAGS) $(DIETLIBC_INCLUDES) $(INCS) -c $< -o $@
+ gcc $(CFLAGS) $(DEFS) $(INCS) $(DIETLIBC_INCLUDES) -c $< -o $@
diff --git a/mdk-stage1/newt/windows.c b/mdk-stage1/newt/windows.c
index bd0e7e802..30a8d526c 100644
--- a/mdk-stage1/newt/windows.c
+++ b/mdk-stage1/newt/windows.c
@@ -154,7 +154,7 @@ int newtWinMenu(char * title, char * text, int suggestedWidth, int flexDown,
listbox = newtListbox(-1, -1, maxListHeight,
(needScroll ? NEWT_FLAG_SCROLL : 0) | NEWT_FLAG_RETURNEXIT);
for (i = 0; items[i]; i++) {
- newtListboxAddEntry(listbox, items[i], (void *) i);
+ newtListboxAddEntry(listbox, items[i], (void *) (long)i);
}
newtListboxSetCurrent(listbox, *listItem);
diff --git a/mdk-stage1/slang/Makefile b/mdk-stage1/slang/Makefile
index c78ee4668..4cd1dc6bb 100644
--- a/mdk-stage1/slang/Makefile
+++ b/mdk-stage1/slang/Makefile
@@ -18,31 +18,39 @@ top_dir = ..
include $(top_dir)/Makefile.common
-all: libslang.a libslang-DIET.a
+LIBNAME = libslang
-clean:
- rm -f *.o *.a
+OBJS = sltermin.o sldisply.o slutty.o slang.o slarray.o slclass.o slcmd.o slerr.o slgetkey.o slkeymap.o slmalloc.o slmath.o slmemchr.o slmemcmp.o slmemcpy.o slmemset.o slmisc.o slparse.o slprepr.o slregexp.o slrline.o slsearch.o slsmg.o slstd.o sltoken.o sltypes.o slxstrng.o slcurses.o slscroll.o slsignal.o slkeypad.o slerrno.o slstring.o slstruct.o slcmplex.o slarrfun.o slimport.o slpath.o slarith.o slassoc.o slcompat.o slposdir.o slstdio.o slproc.o sltime.o slstrops.o slbstr.o slpack.o slintall.o slistruc.o slposio.o slnspace.o slarrmis.o slospath.o slscanf.o
-FLAGS = -Wall -Werror -Os -fomit-frame-pointer -Dunix -DSLANG -c
+DEFS = -Dunix -DSLANG
+INCS =
-OBJS = sltermin.o sldisply.o slutty.o slang.o slarray.o slclass.o slcmd.o slerr.o slgetkey.o slkeymap.o slmalloc.o slmath.o slmemchr.o slmemcmp.o slmemcpy.o slmemset.o slmisc.o slparse.o slprepr.o slregexp.o slrline.o slsearch.o slsmg.o slstd.o sltoken.o sltypes.o slxstrng.o slcurses.o slscroll.o slsignal.o slkeypad.o slerrno.o slstring.o slstruct.o slcmplex.o slarrfun.o slimport.o slpath.o slarith.o slassoc.o slcompat.o slposdir.o slstdio.o slproc.o sltime.o slstrops.o slbstr.o slpack.o slintall.o slistruc.o slposio.o slnspace.o slarrmis.o slospath.o slscanf.o
-OBJS-DIET = $(subst .o,-DIET.o,$(OBJS))
+TARGETS = $(LIBNAME).a
+
+ifeq (DIETLIBC, $(L))
+TARGETS += $(LIBNAME)-DIET.a
+endif
+all: $(TARGETS)
-libslang.a: $(OBJS)
+clean:
+ rm -f *.o *.a
+
+OBJS-DIET = $(subst .o,-DIET.o,$(OBJS))
+
+$(LIBNAME).a: $(OBJS)
ar -cru $@ $^
ranlib $@
-libslang-DIET.a: $(OBJS-DIET)
+$(LIBNAME)-DIET.a: $(OBJS-DIET)
ar -cru $@ $^
ranlib $@
-
$(OBJS): %.o: %.c
- gcc $(FLAGS) $(GLIBC_INCLUDES) -c $< -o $@
+ gcc $(CFLAGS) $(DEFS) $(INCS) $(GLIBC_INCLUDES) -c $< -o $@
$(OBJS-DIET): %-DIET.o: %.c
- gcc $(FLAGS) $(DIETLIBC_INCLUDES) -c $< -o $@
+ gcc $(CFLAGS) $(DEFS) $(INCS) $(DIETLIBC_INCLUDES) -c $< -o $@
diff --git a/mdk-stage1/slang/slmalloc.c b/mdk-stage1/slang/slmalloc.c
index 914e1e0ef..be4ed6cae 100644
--- a/mdk-stage1/slang/slmalloc.c
+++ b/mdk-stage1/slang/slmalloc.c
@@ -94,7 +94,7 @@ static int check_memory (unsigned char *p, char *what)
if (n == 0xFFFFFFFFUL)
{
- sprintf (buf, "%s: %p: Already FREE! Abort NOW.", what, p - Chunk);
+ sprintf (buf, "%s: %p: Already FREE! Abort NOW.", what, (void*)p - Chunk);
SLmalloc_doerror (buf);
return -1;
}
@@ -104,7 +104,7 @@ static int check_memory (unsigned char *p, char *what)
|| (*(p + (int) (n + 2)) != 81)
|| (*(p + (int) (n + 3)) != 86))
{
- sprintf (buf, "\007%s: %p: Memory corrupt! Abort NOW.", what, p);
+ sprintf (buf, "\007%s: %p: Memory corrupt! Abort NOW.", what, (void*)p);
SLmalloc_doerror (buf);
return -1;
}
@@ -115,7 +115,7 @@ static int check_memory (unsigned char *p, char *what)
if (Total_Allocated < 0)
{
sprintf (buf, "\007%s: %p\nFreed %ld, Allocated is: %ld!\n",
- what, p, (long) n, Total_Allocated);
+ what, (void*)p, (long) n, Total_Allocated);
SLang_doerror (buf);
}
#ifdef SLDEBUG_DOUT
diff --git a/mdk-stage1/stage1.c b/mdk-stage1/stage1.c
index 1f39489a1..66aa0e3e1 100644
--- a/mdk-stage1/stage1.c
+++ b/mdk-stage1/stage1.c
@@ -34,6 +34,7 @@
#include <errno.h>
#include <ctype.h>
#include <stdarg.h>
+#include <signal.h>
#include "stage1.h"