--- trunk/mkinitrd-magellan/grubby/Makefile 2007/09/01 22:45:15 532 +++ tags/grubby-8_30/Makefile 2014/07/16 10:44:11 2691 @@ -1,33 +1,64 @@ -VERSION=$(shell cat ../VERSION) +# +# Makefile +# +# Copyright 2007-2009 Red Hat, Inc. All rights reserved. +# +# 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 +# (at your option) 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, see . +# + +VERSION=$(shell cat VERSION) + +TARGETS = grubby +OBJECTS = grubby.o log.o + +CC = gcc +RPM_OPT_FLAGS ?= -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector +CFLAGS += $(RPM_OPT_FLAGS) -std=gnu99 -Wall -Werror -Wno-error=unused-function -Wno-unused-function -ggdb +LDFLAGS := + +grubby_LIBS = -lblkid -lpopt + +PREFIX = /usr +sbindir = $(PREFIX)/sbin +mandir = /usr/share/man + +all: grubby -ARCH := $(patsubst i%86,i386,$(shell uname -m)) -ARCH := $(patsubst sparc%,sparc,$(ARCH)) -ARCH := $(patsubst ppc%,ppc,$(ARCH)) +debug : clean + $(MAKE) CFLAGS="${CFLAGS} -DDEBUG=1" all -CFLAGS = -Wall -g $(CFLAGS) -DVERSION=\"$(VERSION)\" -LDFLAGS = -g +%.o : %.c + $(CC) $(CFLAGS) -DVERSION='"$(VERSION)"' -c -o $@ $< -LOADLIBES = -lpopt - -all: grubby - -test: all +test: all + @export TOPDIR=$(TOPDIR) @./test.sh -install: all - mkdir -p $(DESTDIR)/sbin - mkdir -p $(DESTDIR)/usr/share/man/man8 - install -m 755 new-kernel-pkg $(DESTDIR)/sbin +install: all + mkdir -p $(DESTDIR)/$(sbindir) + mkdir -p $(DESTDIR)/$(mandir)/man8 + install -m 755 new-kernel-pkg $(DESTDIR)/$(sbindir) + install -m 644 new-kernel-pkg.8 $(DESTDIR)/$(mandir)/man8 + install -m 755 installkernel $(DESTDIR)/$(sbindir) + install -m 644 installkernel.8 $(DESTDIR)/$(mandir)/man8 if [ -f grubby ]; then \ - install -m 755 grubby $(DESTDIR)/sbin ; \ - install -m 644 grubby.8 $(DESTDIR)/usr/share/man/man8 ; \ + install -m 755 grubby $(DESTDIR)/$(sbindir) ; \ + install -m 644 grubby.8 $(DESTDIR)/$(mandir)/man8 ; \ fi -grubby: grubby.o mount_by_label.o - $(CC) -o $@ $^ -Wl,-Bstatic $(LOADLIBES) -Wl,-Bdynamic $(CFLAGS) $(LDFLAGS) - -%.o: %.c - $(CC) -c $(CFLAGS) -o $@ $< +grubby:: $(OBJECTS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(grubby_LIBS) clean: - rm -f grubby *.o + rm -f *.o grubby *~