[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
makefile mysteries
- To: st-hackers <syscalltrack-hackers(at-nospam)lists.sourceforge.net>
- Subject: makefile mysteries
- From: mulix <mulix(at-nospam)actcom.co.il>
- Date: Sat, 8 Sep 2001 16:04:35 +0300 (IDT)
- Cc: <linux-il(at-nospam)linux.org.il>
- Delivered-To: linux.org.il-linux-il@linux.org.il
- Sender: linux-il-bounce(at-nospam)cs.huji.ac.il
hi guys,
even though today was declared to be a 'non syscalltrack day', a
Makefile bug bit apparitio and seemed "simple enough to fix".
these words are, in case you dont know, high on the list of famous last
words.
we want to check if an environemnt variable is set, and if not, die.
simple, eh? not. if i do the obvious
ifeq ($(string $(KERNEL_DIR)),)
@echo bla bla
@exit 1
endif
at the top of the Makefile, make complains loudly about "*** commands
commence before first target. Stop.". there must be some simple
solution to this (adding a phony target?), but i couldnt find it. for
now, i implemented an extra level of indirection, but it's pretty ugly.
help?
my solution (snipped off irrelevant stuff)
# Makefile for syscalltrack_modules.
# (loosely based on the examples in rubini's device drivers book)
ifeq ($(strip $(KERNEL_DIR)), )
NO_KERNEL = 1
else
include $(KERNEL_DIR)/.config
endif
[ various variable declarations ]
FINAL_MODS = st_rules.o syscall_hijack.o
all: check_kernel $(FINAL_MODS)
check_kernel:
ifeq ($(NO_KERNEL),1)
@echo
@echo "you must set KERNEL_DIR (consult COMPILING)"
@echo
@exit 1
endif
st_rules.o: $(OBJECTS)
$(LD) -r $^ -o $@
# extra rule to compile files found in $(RULES_LOC)
%.o: $(RULES_LOC)/%.c
$(CC) $(CFLAGS) $(DFLAGS) -c $<
--
mulix
http://www.advogato.com/person/mulix
http://www.sf.net/projects/syscalltrack
=================================================================
To unsubscribe, send mail to linux-il-request@linux.org.il with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail linux-il-request@linux.org.il