Morning rommers, been playing with combining the different makefiles as I
feel that are part of the clutter in my directories, but I keep banging my
head agents the wall.

I wanted to be able to type make, and then get a list little like this:
"linux.............................Linux v. N/A"
"netbsd...........................NetBSD v. N/A"
"openbsd.........................OpenBSD v. N/A"
"freebsd.........................FreeBSD v. N/A"
"solaris.........................Solaris v. N/A"
"----------------------------------------------"
"Usages: make system <Hit Enter>"
"----------------------------------------------"
and then use make Linux to compile on a my Linuxbox, but I ran into I little
problem,
as it seams like I cant changes C_FLAGS, L_FLAGS or LIBS when iam in the
different subs,
iam properly doing allot of stuff wrong, I know of another way I could do it
but it is not how I
wanted it, the other way was with make arch=linux make arch=freebsd but as I
sed it was not
what I intended.

Maybe I could call the makefile multiply times as it would first call make
Linux then
it would go to the Linux sub and do an make arch=linux and then check arch
using ifeq or ifneq
but I just wanted to ask all the great brains on here, been working on this
all-night and is quite sleepy.

I will include what I have now, it does not work at all.
----------------------------------------------------------------------------
---
CC              = gcc
REMOVE     = rm
EXECUTEABLE = mace
SRC_FILES := $(wildcard *.c)
OBJ_FILES := $(patsubst %.c,%.o,$(SRC_FILES))
PROFILING   = -O -g
L_FLAGS     = $(PROFILING)
C_FLAGS     = -Wall $(PROFILING)
LIBS             =

menu:
        @echo "----------------------------------------------"
        @echo "linux.............................Linux v. N/A"
        @echo "netbsd...........................NetBSD v. N/A"
        @echo "openbsd.........................OpenBSD v. N/A"
        @echo "freebsd.........................FreeBSD v. N/A"
        @echo "solaris.........................Solaris v. N/A"
        @echo "----------------------------------------------"
        @echo "Usages: make system <Hit Enter>"
        @echo "----------------------------------------------"

linux: compile
        $(LIBS += -lcrypt)
        $C_FLAGS = $C_FLAGS

netbsd: compile
        $(LIBS)
        $C_FLAGS += -DOLD_RAND -DNOCRYPT

openbsd: compile
        $(LIBS)
        $C_FLAGS += -DOLD_RAND -DNOCRYPT

freebsd: compile
        $(LIBS)
        $C_FLAGS += -DOLD_RAND -DNOCRYPT

solaris: compile
        $(LIBS += -lsocket -lresolv -lnsl)
        $C_FLAGS = $C_FLAGS

compile:$(OBJ_FILES)
        $(REMOVE) -f $(EXECUTEABLE)
        $(CC) $(L_FLAGS) -o $(EXECUTEABLE) $(OBJ_FILES) $(LIBS)

.c.o: merc.h
        $(CC) -c $(C_FLAGS) $<

clean:
        $(REMOVE) -f $(OBJ_FILES) $(EXECUTEABLE) *~ *.bak *.orig *.rej


Hope you can help out.
-- Kawaki

Reply via email to