# tab:8 # Make.split-c - Prototypical Makefile for Split-C programs # # Use gmake! # # This is the default Makefile for Split-C programs on the CM-5. It is a # little complicated because it tries to figure out reasonable defaults # for just about everything. If you have to roll your own, remember that # ``split-cc'' works just like ``gcc'' except that it knows about files # ending in ``.sc'' and about linking with ``cmld'', so write a standard # Makefile substituting split-cc for cc and for ld. The major limitation # of this makefile is to allow only a single executable to be generated. # TvE # # "Copyright (c) 1992 The Regents of the University of California. # All rights reserved. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose, without fee, and without written agreement is # hereby granted, provided that the above copyright notice and the following # two paragraphs appear in all copies of this software. # # IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR # DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT # OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF # CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY # AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS # ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO # PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS." # # Author: Thorsten von Eicken # Version: 130 # Creation Date: Sun Jan 24 23:13:01 PST 1993 # Filename: Make.split-c # History: # SL 9 Mon Feb 7 09:04:36 1994 # Fix CPFLAGS when DIR_LIBSPLITC undefined # LTL 8 Thu Oct 21 18:29:13 1993 # Use CMMD version of library by default # LTL 7 Mon Aug 16 14:00:20 1993 # Modified to compile and link with either CMAM or CMMD version # of libsplitc # SL 6 Mon May 31 22:07:14 1993 # Added libraries and lib load path for X interface. # TvE 5 Tue Apr 13 21:53:25 PDT 1993 # Respect $CMOST variable brought in from Make.site to point to # the CM-5 software (instead of our /usr/cm5). # TvE 4 Sat Apr 3 23:35:57 PST 1993 # Changed uninstalled split-cc to -B${DIR_SPLITCC}/gcc-lib/ # TvE 3 Tue Jan 26 13:03:14 PST 1993 # Added DIR_SPLITCC and DIR_LIBSPLITC recognition even without # using TIC_REGSITRY # TvE 2 Sun Jan 24 23:48:19 PST 1993 # Fixed CFLAGS problem: CFLAGS is by default *undefined*! # # # Definitions you can override in the Makefile that includes this one: # # MPL := CMAM | CMMD | NXAM (this specifies the message passing library # that you are using). # CASTLE:= top-level directory of Split-C installation. In the Split-C # examples this is set in Make.site. Default: /usr/castle # TARGET:= name of executable, default: `fgrep -l 'splitc_main(' *.sc` # SRCS := list of all source files, default: *.c *.sc *.s except for *_cp.c # LIBS := additional libraries to link on pe, e.g. ``-lcmmd_pe'', # default: none # CC := C compiler, default: gcc # SCC := Split-C compiler, default: ${CASTLE}/bin/split-cc # CFLAGS:= C compiler flags, default: -g -O. # -L/usr/castle/lib -L/usr/cm5/lib # SCFLAGS := Split-C compiler flags. default: same as CFLAGS. # ARC_FLAGS :=Architecture specific flags. Varies depending upon the machine. # These include the flags that used to be passed by the compiler on # the CM5. # # # Additional stuff you might want: # # XCFLAGS := gets added to CFLAGS # CPSRCS := list of all host source files, default: *_cp.c # CPLIBS := list of additional host libraries, default: none # CPCC := compiler for host files, default: gcc, note that split-cc can't # be used here because it passes -Dpe_obj to cpp # CPFLAGS := compiler flags for host files, default: -g -O -DCM5 # -I/usr/castle/include -I/usr/cm5/include # XCPFLAGS := gets added to CPFLAGS # NODEPEND := if defined, do not run makedepend automatically, default: # undefined you can use ``gmake depend'' to run makedepend # DIR_SPLITCC := uninstalled split-cc directory, default null # DIR_LIBSPLITC := uninstalled libsplit-c directory, default null # The user needs to set MPL for the platform to use and SC_ROOT to the # root of the Split-C install tree. ifndef SC_ROOT SC_ROOT := /usr/castle/share/proj/split-c/install endif # ARC_FLAGS defines the flags specific to an architecture # MPL is the type of message passing library # BIN := bin-${MPL} SCC := ${SC_ROOT}/${MPL}/bin/split-cc # General definitions and defaults # ifndef TARGET TARGET := ${basename ${shell fgrep -l 'splitc_main(' *.sc}} endif ifndef SRCS ifndef CM5 SRCS := ${filter-out %_cp.c, ${wildcard *.[sc] *.sc}} else SRCS := ${wildcard *.[sc] *.sc} endif endif ifndef LIBS LIBS := endif ifeq "${origin CC}" "default" CC := gcc endif ifeq "${origin CFLAGS}" "undefined" CFLAGS := -g -O ${XCFLAGS} endif ifndef CPSRCS CPSRCS := ${wildcard *_cp.c} endif ifndef CPLIBS CPLIBS := endif ifndef CPCC CPCC := gcc endif ifndef SCFLAGS SCFLAGS := -g -O2 endif ifndef CFLAGS CFLAGS := -g -O2 endif # Files we need to make # OBJS := ${addprefix ${BIN}/,${addsuffix .o,${basename ${SRCS}}}} CPOBJS := ${addprefix ${BIN}/,${addsuffix .o,${basename ${CPSRCS}}}} .PHONY: default clean clear depend ifndef NODEPEND default: depend ${BIN} ${TARGET} else default: ${BIN} ${TARGET} endif distclean: rm -f ${BIN}/*.o clean: rm -f ${BIN}/*.o clear: rm -rf ${BIN} ${TARGET} # Generate dependency file. Use makedepend to parse source files and generate # a Make.depend file. Gmake knows it has to parse that before proceeding. # DEP := Make.depend.${MPL} depend: ${DEP} ${DEP}: ${SRCS} @test -f ${DEP} || touch ${DEP} makedepend -f${DEP} -p${BIN}/ -- ${CFLAGS} -- $^ @rm ${DEP}.bak include ${DEP} # Rule for the bin directory (this relies on the order of dependencies in the # `default' rule ${BIN}: mkdir $@ # Implicit rules to generate object files. You can override these by # placing your own in your Makefile after you include this one. (The gmake # manual says that the first implicit rule is taken. In reality, gmake takes # the last one...) # # Rules for PN objects ${BIN}/%.o: %.c ${CC} ${CFLAGS} -o $@ -c $*.c ${BIN}/%.o: %.sc ${SCC} ${SCFLAGS} -o $@ -c $*.sc ${BIN}/%.o: %.s ${CC} ${CFLAGS} -o $@ -c $*.s # Rule for CP objects (this uses a `static' pattern rule to override the above # implicit rule to from .c to ${BIN}/.c) ${TARGET}: ${OBJS} ${SCC} -o $@ ${OBJS} ${LIBS}