Debian Codegraph @

otherlibs/unix/Makefile

raw
1 #**************************************************************************
2 #* *
3 #* OCaml *
4 #* *
5 #* Xavier Leroy, projet Cristal, INRIA Rocquencourt *
6 #* *
7 #* Copyright 1999 Institut National de Recherche en Informatique et *
8 #* en Automatique. *
9 #* *
10 #* All rights reserved. This file is distributed under the terms of *
11 #* the GNU Lesser General Public License version 2.1, with the *
12 #* special exception on linking described in the file LICENSE. *
13 #* *
14 #**************************************************************************
15
16 # Makefile for the Unix interface library
17
18 ROOTDIR = ../..
19 # Note: at the moment, we need to include the configuration makefile directly
20 # even before we can include Makefile.otherlibs.common
21 # because the UNIX_OR_WIN32 variable must be defined even before
22 # we can include Makefile.otherlibs.common
23 # This will be fixed later
24 include $(ROOTDIR)/Makefile.config_if_required
25
26 LIBNAME=unix
27
28 EXTRACAMLFLAGS=-nolabels
29
30 # This flag is used to disable compatibility definitions in header files to
31 # ensure that they're not accidentally used in the library itself.
32 OC_CPPFLAGS += -DCAML_BUILDING_UNIX
33
34 unixLabels.cmi: \
35 EXTRACAMLFLAGS += -pp "$(AWK) -f $(ROOTDIR)/stdlib/expand_module_aliases.awk"
36
37 ifeq "$(UNIX_OR_WIN32)" "win32"
38 WIN32_LIBS=$(call SYSLIB,ws2_32) $(call SYSLIB,advapi32)
39 LINKOPTS=$(addprefix -cclib ,$(WIN32_LIBS))
40 LDOPTS=$(addprefix -ldopt ,$(WIN32_LIBS))
41 else # Unix
42 # dllunix.so particularly requires libm for modf symbols
43 LDOPTS=$(NATIVECCLIBS)
44 endif
45
46 # C source files common to both Unix and Windows
47 COMMON_C_SOURCES = $(addsuffix .c, \
48 access addrofstr chdir chmod cst2constr cstringv execv execve execvp fsync \
49 mkdir exit getaddrinfo getcwd gethost gethostname getnameinfo getproto \
50 getserv gmtime mmap_ba putenv rmdir socketaddr strofaddr time unlink)
51
52 # OS-specific C source files
53 OS_C_SOURCES = $(addsuffix _$(UNIX_OR_WIN32).c, \
54 accept bind channels close connect dup envir errmsg getpeername getpid \
55 getsockname gettimeofday isatty link listen lockf lseek mmap open pipe \
56 read readlink realpath rename select sendrecv shutdown sleep socket \
57 socketpair sockopt stat symlink times truncate unixsupport utimes write)
58
59 # OS-specific modules that have no counterpart on the other OS
60 ifeq "$(UNIX_OR_WIN32)" "win32"
61 OS_C_SOURCES += $(addsuffix .c, \
62 close_on createprocess nonblock startup system windbug windir winlist \
63 winwait winworker)
64 else
65 OS_C_SOURCES += $(addsuffix .c, \
66 alarm chown chroot closedir dup2 fchmod fchown fcntl fork ftruncate \
67 getegid geteuid getgid getgr getgroups getlogin getppid getpw getuid \
68 initgroups itimer kill mkfifo nice opendir readdir rewinddir setgid \
69 setgroups setsid setuid signals spawn termios umask wait)
70 endif
71
72 C_SOURCES = $(COMMON_C_SOURCES) $(OS_C_SOURCES)
73
74 CAMLOBJS=unix.cmo unixLabels.cmo
75
76 HEADERS=$(addprefix caml/, unixsupport.h socketaddr.h)
77
78 include ../Makefile.otherlibs.common
79
80 distclean::
81 rm -f unix.ml
82
83 .PHONY: depend
84 depend:
85 $(OCAMLDEP_CMD) *.mli *.ml > .depend
86
87 include .depend