--- trunk/mkinitrd-magellan/grubby/Makefile 2007/09/02 00:01:59 547 +++ trunk/mkinitrd-magellan/grubby/Makefile 2009/10/28 00:16:16 914 @@ -1,33 +1,51 @@ +# +# 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) -ARCH := $(patsubst i%86,i386,$(shell uname -m)) -ARCH := $(patsubst sparc%,sparc,$(ARCH)) -ARCH := $(patsubst ppc%,ppc,$(ARCH)) +TARGETS = grubby +OBJECTS = grubby.o -CFLAGS = -Wall -g $(OPTCFLAGS) -DVERSION=\"$(VERSION)\" -LDFLAGS = -g +CFLAGS := $(CFLAGS) $(RPM_OPT_FLAGS) -DVERSION='"$(VERSION)"' -Wall -Werror +LDFLAGS := -LOADLIBES = -lpopt +grubby_LIBS = -lblkid -lpopt +grubby_LIBS += $(shell pkg-config --libs glib-2.0) -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 755 installkernel $(DESTDIR)/sbin 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 *~