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
|
#
# This file is licensed under the terms of the GNU General Public License,
# version 2. See the file COPYING in the main directory for details.
#
# Copyright (C) 2002,2003 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
#
CC = gcc
INSTALL = install
CFLAGS = -mabi=32 -ffreestanding -Os -W -Wall #-DDEBUG
ASFLAGS = $(CFLAGS) -D__ASSEMBLY__
LDFLAGS = -static -T ld.script -L/usr/lib -nostdlib -no-undefined
CPPFLAGS += -I../include
SOURCES = config.c loadecoff.c loadelf.c file.c main.c malloc.c msdos.c \
readext2blocks.c readisoblocks.c start.S stringops.c
OBJS = $(patsubst %.S,%.o,$(patsubst %.c,%.o,$(SOURCES)))
LIBS = -lext2fs -lcom_err
.PHONY = all install clean reallyclean
all: delo.2nd
%.o: %.c
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
%.o: %.S
$(CC) $(ASFLAGS) $(CPPFLAGS) -c -o $@ $<
delo.2nd: $(OBJS)
$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
install: delo.2nd
$(INSTALL) -d -m 0755 /boot
$(INSTALL) -m 0644 delo.2nd /boot
tags:
ctags *.h *.c
clean:
-rm -f $(OBJS) $(OBJS:.o=.d) core tags *~
reallyclean: clean
-rm -f delo.2nd
# Dependency handling
%.d: %.c
@set -e; $(CC) -MM $(CPPFLAGS) $< \
| sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \
[ -s $@ ] || rm -f $@
%.d: %.S
@set -e; $(CC) -MM $(CPPFLAGS) $< \
| sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \
[ -s $@ ] || rm -f $@
ifneq ($(MAKECMDGOALS),clean)
-include $(OBJS:.o=.d)
endif
|