--- trunk/mkinitrd-magellan/grubby/Makefile 2007/09/01 22:45:15 532 +++ trunk/grubby/Makefile 2011/06/03 21:09:58 1339 @@ -1,33 +1,54 @@ -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 + +CFLAGS := $(CFLAGS) $(RPM_OPT_FLAGS) -DVERSION='"$(VERSION)"' -Wall -Werror +LDFLAGS := -ARCH := $(patsubst i%86,i386,$(shell uname -m)) -ARCH := $(patsubst sparc%,sparc,$(ARCH)) -ARCH := $(patsubst ppc%,ppc,$(ARCH)) +grubby_LIBS = -lblkid -lpopt -CFLAGS = -Wall -g $(CFLAGS) -DVERSION=\"$(VERSION)\" -LDFLAGS = -g +mandir = usr/share/man -LOADLIBES = -lpopt +all: grubby -all: grubby - -test: all +test: all + @export TOPDIR=$(TOPDIR) @./test.sh -install: all +install: all mkdir -p $(DESTDIR)/sbin - mkdir -p $(DESTDIR)/usr/share/man/man8 + mkdir -p $(DESTDIR)/$(mandir)/man8 install -m 755 new-kernel-pkg $(DESTDIR)/sbin + install -m 644 new-kernel-pkg.8 $(DESTDIR)/$(mandir)/man8 + install -m 755 installkernel $(DESTDIR)/sbin + 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 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 *~