summaryrefslogtreecommitdiff
path: root/mit-pthreads/GNUmakefile
blob: e3fd53b48e53042f84195af4b18fd3560f4b02de (plain)
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
122
123
124
125
126
127
128
129
# === GNUmakefile =============================================================
# Copyright (c) 1991, 1992, 1993 Chris Provenzano, proven@athena.mit.edu
#
#	Description: This file is for creating libpthread.a
#
#	1.00 93/11/17 proven
#		-Put all the .o files into one file libpthread.a
#		-Initial cut for pthreads.
#

INSTALL_PATH = $(exec_prefix)

      BINDIR = $(INSTALL_PATH)/bin
      LIBDIR = $(INSTALL_PATH)/lib
      MANDIR = $(INSTALL_PATH)/man
      INCDIR = $(INSTALL_PATH)/include
   SUBINCDIR = $(INCDIR)/pthread

          AR = ar
          AS = gas
      CFLAGS = -I. -Iinclude -I$(srcdir)/include -DPTHREAD_KERNEL \
		-O3 -DDBUG_OFF   -Werror
    CXXFLAGS = -I. -Iinclude -I$(srcdir)/include -DPTHREAD_KERNEL \
		-g -O2
          LD = gld

        CSRC =

 PTHREAD_DIR = pthreads stdlib stdio gen
        DIRS = $(PTHREAD_DIR)

     HEADERS =

   LIBRARIES = libpthread.a

     .CURDIR = .

# force correct default target
all:

###############################################################################
#
# Read in any special flags that config knows about
include config.flags

# What the heck.  Convert srcdir to absolute form so it looks prettier.
srcdir := $(shell cd $(srcfoo) && pwd)

################################################################################
#
# Here starts the nitty grity part of the Makefile.

all-lib : libpthread.a

include ${srcdir}/pthreads/GNUmakefile.inc
include ${srcdir}/stdlib/GNUmakefile.inc
include ${srcdir}/stdio/GNUmakefile.inc
include ${srcdir}/string/GNUmakefile.inc
include ${srcdir}/gen/GNUmakefile.inc
include ${srcdir}/net/GNUmakefile.inc
include ${srcdir}/scripts/GNUmakefile.inc

REGULAR_OBJS= $(subst .cc,.o,$(SRCS))
REGULAR_OBJS:= $(subst .c,.o,$(REGULAR_OBJS))
REGULAR_OBJS:= $(subst .S,.o,$(REGULAR_OBJS))
OBJS= $(REGULAR_OBJS) $(EXTRA_OBJS)
REALOBJS = $(addprefix obj/, $(OBJS))

$(REALOBJS) : $(config) $(types) $(paths)

# Since we do not have a list of the relevant files we do a make clean
# before copying everyting to the distribution directory.
distdir:
	$(MAKE) clean
	cp -a . $(distdir)
	# Remove symlinks that the distribution should not have.
	rm -f	$(distdir)/config.cache \
		$(distdir)/include/pthread/machdep.h \
		$(distdir)/include/pthread/posix.h \
		$(distdir)/include/sys \
		$(distdir)/machdep.c \
		$(distdir)/syscall.S \
		$(distdir)/syscall-template.S

clean: 
	rm -f a.out core maketmp makeout $(LIBRARIES) $(BINARIES) libpthread.*
	rm -rf obj
	cd tests && $(MAKE) clean && cd ..

install-lib: $(LIBRARIES) install-dirs
	for x in $(LIBRARIES); \
	do install $$x $(DESTDIR)$(LIBDIR); \
	done

# Removed make install since mysql uses this in place.
# install-lib install-include install-bin
install: 

libpthread.a: obj/libpthread.a
	rm -f libpthread.a
	ln -s obj/libpthread.a .

obj/libpthread.a: ${REALOBJS}
	rm -f libpthread.a obj/new.a obj/libpthread.a
	cd obj && \
		ar r new.a ${OBJS} && \
		$(RANLIB) new.a && \
		mv -f new.a libpthread.a && \
		cd ..

# For examining a combined symbol table, sizes, &c.
libpthread.o: ${REALOBJS}
	cd obj && ld -r -o ../libpthread.o ${OBJS} && cd ..

obj/x:
	if [ -d obj ]; then true; else mkdir obj; fi
	cp /dev/null obj/x

GNUmakefile: config.status ${srcdir}/config/GNUmakefile.in
	$(SHELL) config.status

obj/%.o: %.c obj/x
	$(CC) $(CFLAGS) -c $< -o $@

obj/%.o: %.cc obj/x
	$(CXX) $(CXXFLAGS) $(CFLAGS) -c $< -o $@

obj/%.o: %.S obj/x
	$(CC) $(CFLAGS) -c $< -o $@