update dev300-m58
[ooovba.git] / dmake / dbug / dbug.mk
blob09aa82d7f37dab4e08d6bd25da9bb890658d44f8
1 # Set the proper macros based on whether we are making the debugging version
2 # or not. The valid parameters to this file are:
4 # DEBUG=1 ==> enable the making of the DBUG version
5 # DBMALLOC=1 ==> enable DBUG version with extensive MALLOC checking
7 # DB_CFLAGS ==> CFLAGS is set to this value at the end if DEBUG=1
8 # DB_LDFLAGS ==> LDFLAGS is set to this at the end if DEBUG=1
9 # DB_LDLIBS ==> LDLIBS is set to this at end if DEBUG=1
11 # The non debug versions of the above three macros are:
13 # NDB_CFLAGS
14 # NDB_LDFLAGS
15 # NDB_LDLIBS
17 # One of the set of three should have values set appropriately prior to
18 # sourcing this file.
20 .IF $(DEBUG)
21 DBUG_SRC += dbug.c
22 DB_CFLAGS += -Idbug/dbug
24 .SETDIR=dbug/dbug : $(DBUG_SRC)
26 # If DBMALLOC is requested (ie non-NULL) then include the sources for
27 # compilation. BSD 4.3 needs the getwd.c source compiled in due to a bug
28 # in the clib getwd routine.
29 .IF $(DBMALLOC)
30 # Serious bug in bsd43 getwd.c would free a string and then use its
31 # value. The DBMALLOC code clears a string when it is free'd so the
32 # value was no longer valid and the returned path for the current
33 # directory was now completely wrong.
34 .IF $(OSRELEASE) == bsd43
35 GETWD_SRC += getwd.c
36 .SETDIR=dbug : $(GETWD_SRC)
37 .END
39 MLC_SRC += malloc.c free.c realloc.c calloc.c string.c\
40 mlc_chk.c mlc_chn.c memory.c tostring.c m_perror.c\
41 m_init.c mallopt.c dump.c
43 .SETDIR=dbug/malloc : $(MLC_SRC)
45 DB_CFLAGS += -Idbug/malloc
46 .END
48 SRC += $(DBUG_SRC) $(MLC_SRC) $(GETWD_SRC)
49 HDR += db.h
51 LDFLAGS += $(DB_LDFLAGS)
52 LDLIBS += $(DB_LDLIBS)
54 __.SILENT !:= $(.SILENT)
55 .SILENT !:= yes
56 TARGET := db$(TARGET)
57 OBJDIR := $(OBJDIR).dbg
58 .SILENT !:= $(__.SILENT)
60 CFLAGS += $(DB_CFLAGS)
61 .KEEP_STATE := _dbstate.mk
62 .ELSE
63 CFLAGS += $(NDB_CFLAGS)
64 LDFLAGS += $(NDB_LDFLAGS)
65 LDLIBS += $(NDB_LDLIBS)
66 .END