"Fossies" - the Fresh Open Source Software Archive

Member "threads/src/Makefile.FreeBSD" (8 Nov 2000, 10171 Bytes) of package /linux/misc/old/pthreads-3.14.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 # Copyright (C) 1992-2000 the Florida State University
    2 #  Distributed by the Florida State University under the terms of the
    3 #  GNU Library General Public License.
    4 #
    5 #This file is part of Pthreads.
    6 #
    7 #Pthreads is free software; you can redistribute it and/or
    8 #modify it under the terms of the GNU Library General Public
    9 #License as published by the Free Software Foundation (version 2).
   10 #
   11 #Pthreads is distributed "AS IS" in the hope that it will be
   12 #useful, but WITHOUT ANY WARRANTY; without even the implied
   13 #warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
   14 #See the GNU Library General Public License for more details.
   15 #
   16 #You should have received a copy of the GNU Library General Public
   17 #License along with Pthreads; see the file COPYING.  If not, write
   18 #to the Free Software Foundation, 675 Mass Ave, Cambridge,
   19 #MA 02139, USA.
   20 #
   21 #Report problems and direct all questions to:
   22 #
   23 #  pthreads-bugs@ada.cs.fsu.edu
   24 #
   25 #  @(#)Makefile.FreeBSD 3.14 11/8/00
   26 #
   27 
   28 #Compile flags:
   29 #__FreeBSD__:       Compile for FreeBSD target
   30 #__linux__:     Compile for Linux target
   31 #_M_UNIX:       Compile for SCO-UNIX target
   32 #ASM_SETJMP:        setjmp/longjmp reimplemented (with thread-specific
   33 #           signal mask) in assembly. If this flag is not set,
   34 #           the regular C library routines will be used. This
   35 #           increases the portability but violates Pthreads
   36 #           since the thread-specific signal mask may or may not
   37 #           be saved. Thus, it should only be omitted when
   38 #           absolutely necessary (for quick & dirty portability).
   39 #C_CONTEXT_SWITCH:  for context switch written in C. Notice that the
   40 #           assembly version for the SPARC is faster but by far
   41 #           less portable (see portability notes in disp.c
   42 #           and assembly file *.S).
   43 #           Internal signal handling (pthread_kill) is also much
   44 #           slower with the context switch in C, about a factor 2.
   45 #           speed(C context switch) =~ 1.2*speed(as context switch)
   46 #C_INTERFACE:       for C-language interface; if this option is omitted,
   47 #           a language-independent interface will be generated
   48 #           which has been tested for Verdix/SunAda. It seems that
   49 #           this flag should only be omitted for Verdix/SunAda.
   50 #           All other compilers follow C interface specs.
   51 #CLEANUP_HEAP:      allocate cleanup handlers on heap (default: stack).
   52 #DEBUG:         dump out trace information (mainly for signals).
   53 #DEF_RR:        supports round-robin time-sliced scheduling.
   54 #           Only works properly when MALLOC is also defined.
   55 #IO:            I/O operations only block current thread, not process.
   56 #           (SunOS 4.1.x kernel configuration must include
   57 #           light-weight processes [LWP] and aynchronous I/O [AIO];
   58 #           under Solaris 2.x, link with -laio -ldl.)
   59 #MALLOC:        thread-safe malloc, in conjuction with Gnu malloc lib.
   60 #           See README for more information.
   61 #MUT_SWITCH:        forces context switch upon successful mutex_lock()
   62 #           with regard to priorities (do not define NOERR_CHECK)
   63 #NOERR_CHECK:       fast mutex operations without error checking.
   64 #NO_INLINE:     no inlines for macros (internally CLEAR_KERNEL_FLAG).
   65 #RAND_SWITCH:       forces context switch on kernel exit at random intervals
   66 #           and to random threads without regard to priorities
   67 #           (do not define NOERR_CHECK)
   68 #REAL_TIME:     real-time scheduling support (implementation defined)
   69 #RR_SWITCH:     forces context switch on kernel exit (round-robin queue)
   70 #           without regard to priorities (do not define NOERR_CHECK)
   71 #SIGNAL_STACK:      Allows user to execute handlers in case of a stack
   72 #           overflow. STACK_CHECK has to be on for this.
   73 #SIM_KERNEL:        simulate kernel implementation by using dummy UNIX
   74 #           system call in selected routines.
   75 #SOLARIS:       support for Solaris 2.x. Need to define SVR4 as well.
   76 #           If you want to compile for Solaris, change this
   77 #           Makefile by deleting/inserting
   78 #           comments wherever the string "Solaris" occurs.
   79 #SRP:           support of mutex ceiling under stack resource
   80 #           policy (SRP)
   81 #           if not defined, _POSIX_THREADS_PRIO_PROTECT has to be
   82 #           undefined in unistd.h!
   83 #STACK_CHECK:       lock page to cause bus error / illegal instruction
   84 #           on stack overflow
   85 #STAND_ALONE:       micro-kernel for VME SPARC Engine 1E; works only in
   86 #           conjunction with SRP and no other compile options
   87 #sun4e:         Sun SPARC 1E VME board (STAND_ALONE MythOS version)
   88 #sun4m:         Force SPARC 3CE VME board (STAND_ALONE MythOS version)
   89 #SVR4:          System V Release 4 UNIX system. For portability.
   90 #           Currently supports Solaris only. If not defined,
   91 #           BSD (Berkley) UNIX is assumed (currently SunOS 4.1.x).
   92 #TIMER_DEBUG:       dump out trace information for SIGALRM signals and timer
   93 #VME_ICACHE_OFF:    turn I-cache off (only w/ STAND_ALONE and sun4m)
   94 #VME_DCACHE_OFF:    turn D-cache off (only w/ STAND_ALONE and sun4m)
   95 
   96 #include directory location
   97 INCS = ../include
   98 PINC = $(INCS)/pthread
   99 INC1 = -I$(INCS)
  100 INC2 = 
  101 
  102 #for cross-compilation
  103 #INC2 = -I/home/midasusr/include
  104 #INC2 = -I/sim/usr/include
  105 
  106 #install directory locations
  107 INSTALL_INCLUDE = /usr/local/include
  108 INSTALL_LIBS = /usr/local/lib
  109 #for Logware
  110 #INSTALL_INCLUDE = /usr/contrib/include
  111 #INSTALL_LIBS = /usr/contrib/lib
  112 
  113 FBSD_ASM_INC =
  114 
  115 #SPARC port flags
  116 #for shipping
  117 #CFLAGS = -DASM_SETJMP -DNOERR_CHECK -DSTACK_CHECK -DSIGNAL_STACK
  118 #for maximum portability (minimum assembly required)
  119 #CFLAGS = -DCLEANUP_HEAP -DC_CONTEXT_SWITCH
  120 #for thread-safe malloc and round-robin scheduling option
  121 #CFLAGS = -DASM_SETJMP -DNOERR_CHECK -DSTACK_CHECK -DSIGNAL_STACK \
  122 #   -DMALLOC -DNO_FIX_MALLOC -DDEF_RR
  123 #for GNARL project
  124 #CFLAGS = -DASM_SETJMP -DSTACK_CHECK -DSIGNAL_STACK -DMALLOC -DNO_FIX_MALLOC
  125 #for VME SPARC Engine 1E SunOS 4.0.3e (sun4e) / Force 3CE SunOS 4.1.3u (sun4m)
  126 #CFLAGS = -DASM_SETJMP -DNOERR_CHECK -DSTAND_ALONE \
  127 #    -DSTACK_CHECK -DMALLOC -DNO_FIX_MALLOC \
  128 #    -Dsun4m 
  129 #    -DVME_ICACHE_OFF
  130 #    -DVME_DCACHE_OFF
  131 #    -DSTACK_CHECK -DSIGNAL_STACK
  132 #    -Dsun4e -DUARTB
  133 #for testing
  134 #CFLAGS = -DDEBUG -DTIMER_DEBUG -DASM_SETJMP -DSTACK_CHECK -DSIGNAL_STACK
  135 
  136 #Linux / SCO port flags
  137 #CFLAGS =  -DC_CONTEXT_SWITCH -DCLEANUP_HEAP -D_POSIX -DAUTO_INIT
  138 
  139 ##MS-DOS under DJGPP2 flags
  140 #CFLAGS = -DC_CONTEXT_SWITCH -DCLEANUP_HEAP -D_POSIX -D__dos__
  141 
  142 #FreeBSD port flags
  143 CFLAGS =  -DC_CONTEXT_SWITCH -DCLEANUP_HEAP -D_POSIX -DSTACK_CHECK -DAUTO_INIT
  144 FBSD_ASM_INC = -I$(INCS)/../src/freebsd
  145 
  146 #general flags
  147 CFLAGS += -DSRP -DC_INTERFACE
  148 
  149 #for non-process blocking (only thread-blocking) I/O:
  150 CFLAGS += -DIO -DMALLOC -DNO_FIX_MALLOC
  151 
  152 #for shipping
  153 CCFLAGS = -O2 $(CFLAGS)
  154 CCFLAGS1 = -O1 $(CFLAGS)
  155 CCFLAGS2 = -O2 $(CFLAGS)
  156 CCFLAGS3 = -O0 $(CFLAGS)
  157 #for testing
  158 #CCFLAGS = -g $(CFLAGS)
  159 #CCFLAGS1 = $(CCFLAGS)
  160 #CCFLAGS2 = $(CCFLAGS)
  161 #CCFLAGS3 = $(CCFLAGS)
  162 
  163 #compile flags, always the same
  164 CCFLAGS0 = $(CCFLAGS)
  165 
  166 #for Gnu C compiler
  167 CC = gcc
  168 COMP_ASM = $(CC) $(INC1) $(INC2) $(FBSD_ASM_INC) $(CFLAGS) -c $*.S
  169 #for Sun C
  170 #COMP_ASM = $(AS) $(INC1) $(INC2) -P $(CFLAGS) $*.S -o $*.o
  171 #for Sun C under Solaris 2.x
  172 #delete comment designator "#" in the line below if you use /usr/lang/cc
  173 #CC = /usr/lang/cc
  174 #CC = /vol/rudolf-vol2/SUNWspro/bin/CC
  175 
  176 #for Solaris 2.x
  177 #delete comment designator "#" in the lines below for Solaris 2.x/SunOS 5.x
  178 #CFLAGS += -DSOLARIS -DSVR4
  179 #Only for gcc under SunOS 4/5.x, add "-traditional" in COMP_ASM.
  180 #COMP_ASM += -traditional
  181 
  182 COMP_C   = $(CC) $(INC1) $(INC2) $(CCFLAGS) -c $*.c
  183 COMP_C0  = $(CC) $(INC1) $(INC2) $(CCFLAGS0) -c $*.c
  184 COMP_C1  = $(CC) $(INC1) $(INC2) $(CCFLAGS1) -c $*.c
  185 COMP_C2  = $(CC) $(INC1) $(INC2) $(CCFLAGS2) -c $*.c
  186 COMP_C3  = $(CC) $(INC1) $(INC2) $(CCFLAGS3) -c $*.c
  187 
  188 AR     = ar
  189 RANLIB = ranlib
  190 
  191 LINTFLAGS = -u $(CFLAGS)
  192 
  193 LIB1 = ../lib/libgthreads.a
  194 LIB2 = ../lib/libmalloc.a
  195 LIBS = $(LIB1) $(LIB2)
  196 
  197 CSRC = pthread.c stack.c mutex.c init.c signal.c signal_func.c \
  198     cond.c queue.c io.c disp.c
  199 
  200 SCRS = $(CSRC) sched.S p_aux.S opt.S
  201 
  202 OBJS = pthread.o stack.o mutex.o cond.o init.o \
  203     signal.o signal_func.o sched.o p_aux.o opt.o \
  204     queue.o io.o disp.o
  205 
  206 HDR0 = $(PINC)/config.h config_internals.h
  207 
  208 
  209 HDR1 = internals.h $(INCS)/pthread.h $(PINC)/unistd.h $(PINC)/limits.h \
  210     $(PINC)/errno.h $(PINC)/signal.h $(PINC)/asm.h \
  211     $(HDR0)
  212 
  213 DEP1 = $(HDR1) Makefile
  214 
  215 HDRS = $(HDR1) offsets.h mutex.h signal_internals.h
  216 
  217 all: $(LIBS)
  218 
  219 $(LIB2)::
  220     cd ../malloc; $(MAKE)
  221 
  222 $(LIB1):: $(OBJS)
  223     $(AR) ru $(LIB1) $(OBJS)
  224     $(RANLIB) $(LIB1)
  225 
  226 cond.o: cond.c $(DEP1) mutex.h
  227     $(COMP_C3)
  228 
  229 mutex.o: mutex.c $(DEP1) mutex.h
  230     $(COMP_C)
  231 
  232 pthread.o: pthread.c $(DEP1)
  233     $(COMP_C)
  234 
  235 init.o: init.c $(DEP1) setjmp.h
  236     $(COMP_C)
  237 
  238 signal.o: signal.c $(DEP1) mutex.h signal_internals.h offsets.h setjmp.h
  239     $(COMP_C)
  240 
  241 signal_func.o: signal_func.c $(DEP1) mutex.h internals.h offsets.h setjmp.h
  242     $(COMP_C3)
  243 
  244 stack.o: stack.c $(DEP1)
  245     $(COMP_C)
  246 
  247 queue.o: queue.c $(DEP1)
  248     $(COMP_C)
  249 
  250 io.o: io.c $(DEP1)
  251     $(COMP_C0)
  252 
  253 disp.o: disp.c $(DEP1) setjmp.h
  254     $(COMP_C1)
  255 
  256 sched.o: sched.S $(PINC)/asm.h \
  257         offsets.h signal_internals.h $(HDR0) Makefile
  258     $(COMP_ASM)
  259 #for SunOS 4.1.x and Solaris < 2.4
  260 #   $(COMP_ASM) -DEMPTY
  261 
  262 p_aux.o: p_aux.S $(PINC)/asm.h \
  263         offsets.h $(HDR0) Makefile
  264     $(COMP_ASM)
  265 
  266 opt.o: opt.S $(PINC)/asm.h \
  267         offsets.h $(HDR0) Makefile
  268     $(COMP_ASM)
  269 
  270 offsets.h: get_offsets
  271     ./get_offsets > offsets.h
  272 
  273 get_offsets: get_offsets.c $(DEP1) setjmp.h
  274     $(CC) $(INC1) $(INC2) $(CCFLAGS) -o $@ $@.c
  275 
  276 $(PINC)/config.h: config_header Makefile const.sh
  277     ./config_header -D`uname -r | sed "s/\.//g"` $(CCFLAGS) > $@
  278     sh const.sh >> $@
  279 
  280 config_internals.h: config_header2 Makefile
  281     ./config_header2 -l -D`uname -r | sed "s/\.//"` $(CCFLAGS) > $@
  282 
  283 config_header: config_header.c Makefile
  284     $(CC) $(INC1) $(INC2) $(CCFLAGS) $(CCIFLAGS) -o $@ $@.c
  285 
  286 config_header2: config_header.c Makefile
  287     touch config_internals.h
  288     $(CC) $(INC1) $(INC2) $(CCFLAGS) -DINTERNALS -o $@ $<
  289     rm -f config_internals.h
  290 
  291 ifneq ($(MAKECMDGOALS),clean)
  292 -include .dep
  293 endif
  294 
  295 .dep: $(HDR0) offsets.h Makefile
  296     $(CC) -M $(INC1) $(INC2) $(CFLAGS) *.c *.S > .dep
  297 
  298 
  299 install:
  300     cp $(INCS)/*.h $(INSTALL_INCLUDE)
  301     if ( test ! -d $(INSTALL_INCLUDE)/pthread ) ; then \
  302       mkdir $(INSTALL_INCLUDE)/pthread ; \
  303     fi ;
  304     cp $(INCS)/pthread/*.h $(INSTALL_INCLUDE)/pthread
  305     cp $(LIBS) $(INSTALL_LIBS)
  306 
  307 lint:
  308     lint $(LINTFLAGS) $(CSRC)
  309 
  310 llib:
  311     lint $(LINTFLAGS) -Cthreads $(SRCS)
  312 
  313 clean:
  314     -rm -f $(LIBS) a.out core errs *.o *.EXE *.BAK *.CKP config_internals.h $(PINC)/config.h config_header config_header2 offsets.h get_offsets *~ #* .dep
  315     cd ../malloc; $(MAKE) clean