On Mon, 2006-11-27 at 22:39 +0100, Stefan Seyfried wrote:
> I have no objections and am not really a Makefile specialist, but is
> this necessary?
> I am building our package with
> 
> make ARCH=%_arch \
>         SUSPEND_DIR=/usr/sbin \
>         CFLAGS="$RPM_OPT_FLAGS -Iliblzf-1.6 -Lliblzf-1.6" \
>         CONFIG_COMPRESS=yes \
>         CONFIG_ENCRYPT=yes \
>         CONFIG_UDEV=yes
> 
> and it seems to work fine. It looks like i really have to read up on
> the different ways of variable assignment in Makefiles somewhen :-)

Indeed, not all of that was needed because assignments specified as make
parameters override any standard assignments inside the Makefile.

However, I'd still like to see CFLAGS being pulled in from the
environment (as opposed to a make parameter) so that change remains.

I also removed the /usr/local stuff, enabled UDEV by default, and
changed all the options to be yes/no rather than defined or not. Here's
an updated patch.

Daniel

From: Daniel Drake <[EMAIL PROTECTED]>

Index: suspend/Makefile
===================================================================
--- suspend.orig/Makefile
+++ suspend/Makefile
@@ -1,20 +1,17 @@
-#CONFIG_COMPRESS=yes
-#CONFIG_ENCRYPT=yes
-#CONFIG_SPLASHY=yes
-#CONFIG_UDEV=yes
+CONFIG_COMPRESS=no
+CONFIG_ENCRYPT=no
+CONFIG_SPLASHY=no
+CONFIG_UDEV=yes
 
 ARCH:=$(shell uname -m)
 
-CC_FLAGS=-I/usr/local/include
-LD_FLAGS=-L/usr/local/lib
+CFLAGS ?= -O2 -Wall
 
-CFLAGS := -O2 -Wall
-
-ifdef CONFIG_COMPRESS
+ifeq ($(CONFIG_COMPRESS), yes)
 CC_FLAGS	+= -DCONFIG_COMPRESS
 LD_FLAGS	+= -llzf
 endif
-ifdef CONFIG_ENCRYPT
+ifeq ($(CONFIG_ENCRYPT), yes)
 GCRYPT_CC_FLAGS := $(shell libgcrypt-config --cflags)
 GCRYPT_LD_FLAGS := $(shell libgcrypt-config --libs)
 CC_FLAGS	+= -DCONFIG_ENCRYPT
@@ -31,11 +28,11 @@ S2BOTH=s2both
 S2DISK=s2disk
 CONFIGFILE=suspend.conf
 
-ifndef CONFIG_UDEV
+ifneq ($(CONFIG_UDEV), yes)
 SNAPSHOT=$(DESTDIR)/dev/snapshot
 endif
 
-ifdef CONFIG_ENCRYPT
+ifeq ($(CONFIG_ENCRYPT), yes)
 all: $(S2DISK) $(S2BOTH) swap-offset suspend-keygen resume s2ram
 else
 all: $(S2DISK) $(S2BOTH) swap-offset resume s2ram
@@ -49,7 +46,7 @@ endif
 
 SPLASHOBJ = splash.o bootsplash.o 
 
-ifdef CONFIG_SPLASHY
+ifeq ($(CONFIG_SPLASHY), yes)
 CC_FLAGS	+= -DCONFIG_SPLASHY
 LD_FLAGS	+= -lsplashy
 SPLASHOBJ 	+= splashy_funcs.o 
@@ -122,7 +119,7 @@ resume:	md5.o encrypt.o config.o resume.
 swap-offset: swap-offset.c
 	$(CC) $(CFLAGS) swap-offset.c -o swap-offset
 
-ifdef CONFIG_ENCRYPT
+ifeq ($(CONFIG_ENCRYPT), yes)
 suspend-keygen:	md5.o keygen.c encrypt.h md5.h
 	$(CC) $(CFLAGS) -DHAVE_INTTYPES_H -DHAVE_STDINT_H $(CC_FLAGS) md5.o keygen.c -o suspend-keygen $(LD_FLAGS)
 
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Suspend-devel mailing list
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel

Reply via email to