Re: [SYSTEM-LINUX] Compiler obj files.

From: Torgny Bjers (artovil@arcanerealms.org)
Date: 09/14/02


On 02-09-14 06.36, "Justin Adler" <spam@WORLD-DOMINATION.COM.AU> wrote:

> Hello Circlemud guru's.
>
>  Is there any possible way to modify the stock circlemud MAKEFILE, so
> all the obj files are NOT created in the ../circle/src directory, but
> maybe into ../circle/bin/obj  or somewhere else? and when it makes the
> executable, it already ~knows~ where all the .obj files are?
>
>  Thanks in advance to any help.

Well, here's what you COULD do:

Open up your Makefile.in

..............
LIBS = @LIBS@ @CRYPTLIB@ @NETLIB@
+ # Source files
+ SRC_FILES := $(wildcard *.c)
+
+ # Object files
+ OBJ_DIR=obj
+ OBJ_FILES := $(patsubst %.c,$(OBJ_DIR)/%.o,$(SRC_FILES))
+
+ # Include files
+ INC_FILES := $(wildcard h/*.h)
..............
+ $(OBJ_DIR)/%.o: %.c
+   $(CC) $(CFLAGS) -c $(PROFILE) $< -o $@
+
- clean:
-   rm -f *.o
+ clean: tidy
+   rm -f $(OBJ_FILES)
+
+ tidy:
+   rm -f *~ *orig *bak *rej
..............

Then you alter the references for OBJFILES to OBJ_FILES, and then you can
remove the OBJFILES entirely.  This way you don't have to add new .c files
to the list in OBJFILES, it handles that automagically.

Run ./configure

These lines altered and stolen from the MCL Makefile.

Uhm... :) Have fun.  If anybody found this extremely retarded and
cumbersome, please, enlighten us, since I don't know Jack sh*t about
Makefile and Jack just left town.  I just winged it.

Regards,
/Torgny

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT