EMX_MAKEFILE 3.99 KB
Newer Older
eg's avatar
eg committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#
#  OS/2 specific Makefile for the EMX environment
#
#  You need GNU Make 3.71, gcc 2.5.7, emx 0.8h and GNU fileutils 3.9
#  or similar tools. C++ interface and de.exe weren't tested.
#

# Primary targets:
# gc.a - builds basic library
# c++ - adds C++ interface to library and include directory
# cords - adds cords (heavyweight strings) to library and include directory
# test - prints porting information, then builds basic version of gc.a, and runs
#        some tests of collector and cords.  Does not add cords or c++ interface to gc.a
# cord/de.exe - builds dumb editor based on cords.
CC= gcc
CXX=g++
# Needed only for "make c++", which adds the c++ interface

19
CFLAGS= -O -DALL_INTERIOR_POINTERS -I$(srcdir)/include
eg's avatar
eg committed
20 21 22
# Setjmp_test may yield overly optimistic results when compiled
# without optimization.

23
CXXFLAGS= $(CFLAGS)
eg's avatar
eg committed
24 25 26 27 28 29 30 31
AR= ar
RANLIB= ar s

# Redefining srcdir allows object code for the nonPCR version of the collector
# to be generated in different directories
srcdir = .
VPATH = $(srcdir)

32
OBJS= alloc.o reclaim.o allchblk.o misc.o mach_dep.o os_dep.o mark_rts.o headers.o mark.o obj_map.o blacklst.o finalize.o new_hblk.o dyn_load.o dbg_mlc.o fnlz_mlc.o malloc.o stubborn.o checksums.o typd_mlc.o ptr_chck.o mallocx.o
eg's avatar
eg committed
33

34
CORD_OBJS= cord/cordbscs.o cord/cordxtra.o cord/cordprnt.o
eg's avatar
eg committed
35

36 37
CORD_INCLUDE_FILES= $(srcdir)/include/gc.h $(srcdir)/include/cord.h \
    $(srcdir)/include/ec.h $(srcdir)/include/cord_pos.h
eg's avatar
eg committed
38 39 40 41

# Libraries needed for curses applications.  Only needed for de.
CURSES= -lcurses -ltermlib

42
SPECIALCFLAGS = -I$(srcdir)/include
eg's avatar
eg committed
43 44 45 46 47 48
# Alternative flags to the C compiler for mach_dep.c.
# Mach_dep.c often doesn't like optimization, and it's
# not time-critical anyway.

all: gc.a gctest.exe

49 50 51
$(OBJS) test.o: $(srcdir)/include/private/gc_priv.h \
    $(srcdir)/include/private/gc_hdrs.h $(srcdir)/include/gc.h \
    $(srcdir)/include/private/gcconfig.h $(srcdir)/include/gc_typed.h
eg's avatar
eg committed
52
# The dependency on Makefile is needed.  Changing
eg's avatar
eg committed
53
# options affects the size of GC_arrays,
eg's avatar
eg committed
54 55 56 57 58 59 60 61 62 63 64
# invalidating all .o files that rely on gc_priv.h

mark.o typd_mlc.o finalize.o: $(srcdir)/include/gc_mark.h $(srcdir)/include/private/gc_pmark.h

gc.a: $(OBJS)
	$(AR) ru gc.a $(OBJS)
	$(RANLIB) gc.a

cords: $(CORD_OBJS) cord/cordtest.exe
	$(AR) ru gc.a $(CORD_OBJS)
	$(RANLIB) gc.a
65 66 67 68 69

gc_cpp.o: $(srcdir)/gc_cpp.cc $(srcdir)/include/gc_cpp.h
	$(CXX) -c $(CXXFLAGS) $(srcdir)/gc_cpp.cc

c++: gc_cpp.o $(srcdir)/include/gc_cpp.h
eg's avatar
eg committed
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
	$(AR) ru gc.a gc_cpp.o
	$(RANLIB) gc.a

mach_dep.o: $(srcdir)/mach_dep.c
	$(CC) -o mach_dep.o -c $(SPECIALCFLAGS) $(srcdir)/mach_dep.c

mark_rts.o: $(srcdir)/mark_rts.c
	$(CC) -o mark_rts.o -c $(CFLAGS) $(srcdir)/mark_rts.c

cord/cordbscs.o: $(srcdir)/cord/cordbscs.c $(CORD_INCLUDE_FILES)
	$(CC) $(CFLAGS) -c $(srcdir)/cord/cordbscs.c -o  cord/cordbscs.o

cord/cordxtra.o: $(srcdir)/cord/cordxtra.c $(CORD_INCLUDE_FILES)
	$(CC) $(CFLAGS) -c $(srcdir)/cord/cordxtra.c -o  cord/cordxtra.o

cord/cordprnt.o: $(srcdir)/cord/cordprnt.c $(CORD_INCLUDE_FILES)
	$(CC) $(CFLAGS) -c $(srcdir)/cord/cordprnt.c -o cord/cordprnt.o

88 89
cord/cordtest.exe: $(srcdir)/cord/tests/cordtest.c $(CORD_OBJS) gc.a
	$(CC) $(CFLAGS) -o cord/cordtest.exe $(srcdir)/cord/tests/cordtest.c $(CORD_OBJS) gc.a
eg's avatar
eg committed
90

91 92
cord/de.exe: $(srcdir)/cord/tests/de.c $(srcdir)/cord/cordbscs.o $(srcdir)/cord/cordxtra.o gc.a
	$(CC) $(CFLAGS) -o cord/de.exe $(srcdir)/cord/tests/de.c $(srcdir)/cord/cordbscs.o $(srcdir)/cord/cordxtra.o gc.a $(CURSES)
eg's avatar
eg committed
93

94
clean:
eg's avatar
eg committed
95 96 97 98 99 100 101 102 103 104 105
	rm -f gc.a tests/test.o gctest.exe output-local output-diff $(OBJS) \
	      setjmp_test  mon.out gmon.out a.out core \
	      $(CORD_OBJS) cord/cordtest.exe cord/de.exe
	-rm -f *~

gctest.exe: tests/test.o gc.a
	$(CC) $(CFLAGS) -o gctest.exe tests/test.o gc.a

# If an optimized setjmp_test generates a segmentation fault,
# odds are your compiler is broken.  Gctest may still work.
# Try compiling setjmp_t.c unoptimized.
106 107
setjmp_test.exe: $(srcdir)/tools/setjmp_t.c $(srcdir)/include/gc.h
	$(CC) $(CFLAGS) -o setjmp_test.exe $(srcdir)/tools/setjmp_t.c
eg's avatar
eg committed
108 109 110 111 112 113

test: setjmp_test.exe gctest.exe
	./setjmp_test
	./gctest
	make cord/cordtest.exe
	cord/cordtest