File: Mmakefile

package info (click to toggle)
mercury 0.9-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 18,488 kB
  • ctags: 9,800
  • sloc: objc: 146,680; ansic: 51,418; sh: 6,436; lisp: 1,567; cpp: 1,040; perl: 854; makefile: 450; asm: 232; awk: 203; exp: 32; fortran: 3; csh: 1
file content (121 lines) | stat: -rw-r--r-- 3,376 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#-----------------------------------------------------------------------------#
# Copyright (C) 1997-1999 The University of Melbourne.
# This file may only be copied under the terms of the GNU General
# Public License - see the file COPYING in the Mercury distribution.
#-----------------------------------------------------------------------------#

# Mmake - Mmake file for the Mercury bytecode utilities

MAIN_TARGET=all

MERCURY_DIR=..
include $(MERCURY_DIR)/Mmake.common

#-----------------------------------------------------------------------------#

INCPATH		= -I$(RUNTIME_DIR) \
		  -I$(BOEHM_GC_DIR) \
		  -I$(BOEHM_GC_DIR)/include \
		  -I.
LIBPATH		= -L$(RUNTIME_DIR) -L$(BOEHM_GC_DIR)
CFLAGS		= -g $(EXTRA_CFLAGS) -D_POSIX_SOURCE $(INCPATH) -DDEBUGGING
MGNUC		= MERCURY_ALL_C_INCL_DIRS="$(INCPATH)" $(SCRIPTS_DIR)/mgnuc
MGNUCFLAGS	= $(CFLAGS) 

MAKEDEPEND	= makedepend

# We need VPATH so we can find getopt.h (!)
VPATH		= $(MERCURY_DIR)/runtime

#-----------------------------------------------------------------------------#

MB_HDRS		= bytecode.h dict.h disasm.h mbi.h mem.h machine.h \
		  mdis.h static_data.h template.h util.h

HDRS		= $(MB_HDRS) getopt.h 

ORIG_CS		= bytecode.c dict.c disasm.c machine.c mbi.c mbi_main.c \
		  mdis.c mem.c static_data.c template.c util.c

LIBS		= -lmer ` \
                  case "$(GRADE)" in \
                        *.gc.prof*) echo "-lgc_prof" ;; \
                        *.gc) echo "-lgc" ;; \
                  esac \
                  `

#-----------------------------------------------------------------------------#

.PHONY: all

all: mdb mdis mbi libmbi

MDIS_OBJS = bytecode.o disasm.o mdis.o mem.o util.o
mdis: $(MDIS_OBJS)
	$(MGNUC) $(CFLAGS) -o mdis $(MDIS_OBJS) $(LIBPATH) $(LIBS)

LIBMBI_OBJS = bytecode.o dict.o mbi.o mem.o util.o 
LIBMBI_PIC_OBJS = $(LIBMBI_OBJS:.o=.$(EXT_FOR_PIC_OBJECTS))
MBI_OBJS = mbi_main.o $(LIBMBI_OBJS)

mbi: $(MBI_OBJS)
	$(MGNUC) $(CFLAGS) -o mbi $(MBI_OBJS) $(LIBPATH) $(LIBS)

libmbi: libmbi.a libmbi.$(EXT_FOR_SHARED_LIB)

libmbi.a: $(LIBMBI_OBJS)
	rm -f libmbi.a
	ar cr libmbi.a $(LIBMBI_OBJS)

libmbi.so: $(LIBMBI_OBJS)
	$(LINK_SHARED_OBJ) -o libmbi.so $(LIBMBI_PIC_OBJS) \
		$(LIBPATH) $(LIBS) $(SHARED_LIBS)

mdb: libmbi.so mdb.m
	$(MC) -o mdb mdb.m -L. -lmbi


#-----------------------------------------------------------------------------#

tags: $(ORIG_CS)
	ctags $(ORIG_CS) $(MB_HDRS)

.PHONY: check_headers
check_headers:
	for file in $(HDRS); do \
		echo "$$file"; \
		echo "#include \"$$file\"" > tmp.c; \
		$(MGNUC) $(MGNUCFLAGS) -c tmp.c || exit 1; \
	done
	rm -f tmp.c

# Create dependencies. 
depend:	$(ORIG_CS) $(HDR) 
	if test ! -f depend.mk ; then touch depend.mk ; else true ; fi
	$(MAKEDEPEND) $(INCPATH) -f depend.mk $^


#-----------------------------------------------------------------------------#

# installation rules

install:
	echo "Module \"bytecode\" does not yet install anything."

uninstall:
	echo "Nothing to uninstall for module \"bytecode\""

#-----------------------------------------------------------------------------#

clean_local: 
	rm -f *.o *.pic_o

realclean_local:
	-$(RM) mbi mdis depend.mk* libmbi.a libmbi.so \
		mdb mdb.c mdb.d mdb_init.c

#-----------------------------------------------------------------------------#

-include depend.mk

#-----------------------------------------------------------------------------#