1 #
   2 # CDDL HEADER START
   3 #
   4 # The contents of this file are subject to the terms of the
   5 # Common Development and Distribution License (the "License").
   6 # You may not use this file except in compliance with the License.
   7 #
   8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9 # or http://www.opensolaris.org/os/licensing.
  10 # See the License for the specific language governing permissions
  11 # and limitations under the License.
  12 #
  13 # When distributing Covered Code, include this CDDL HEADER in each
  14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15 # If applicable, add the following below this CDDL HEADER, with the
  16 # fields enclosed by brackets "[]" replaced with your own identifying
  17 # information: Portions Copyright [yyyy] [name of copyright owner]
  18 #
  19 # CDDL HEADER END
  20 #
  21 
  22 #
  23 # Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  24 # Use is subject to license terms.
  25 # Copyright 2015 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
  26 #
  27 
  28 #
  29 #       Path to the base of the uts directory tree (usually /usr/src/uts).
  30 #
  31 UTSBASE = ../../..
  32 
  33 #
  34 #       Define the module and object file sets.
  35 #
  36 UNIX            = unix
  37 OBJECTS         = $(BCM2835_OBJS:%=$(OBJS_DIR)/%) \
  38                   $(CORE_OBJS:%=$(OBJS_DIR)/%) \
  39                   $(KRTLD_OBJS:%=$(OBJS_DIR)/%)
  40 
  41 ROOTMODULE      = $(ROOT_BCM2835_KERN_DIR)/$(UNIX)
  42 UNIX_BIN        = $(OBJS_DIR)/$(UNIX)
  43 
  44 LIBS            = $(GENLIB)
  45 
  46 GENUNIX         = genunix
  47 GENUNIX_DIR     = ../../../arm/$(GENUNIX)
  48 GENOPTS         = -L $(GENUNIX_DIR)/$(OBJS_DIR) -l $(GENUNIX)
  49 
  50 LIBOPTS         = $(GENOPTS)
  51 
  52 CTFEXTRAOBJS    = $(OBJS_DIR)/vers.o
  53 
  54 ARCHIVE         = boot_archive
  55 
  56 INITRD          = initrd
  57 BOOT_MODULE     = $(ROOT_BCM2835_KERN_DIR)/$(INITRD)
  58 INITRD_BIN      = $(OBJS_DIR)/$(INITRD)
  59 
  60 #
  61 #       Include common rules.
  62 #
  63 include $(UTSBASE)/armv6/bcm2835/Makefile.bcm2835
  64 
  65 #
  66 #       Define targets
  67 #
  68 ALL_TARGET      = $(UNIX_BIN)
  69 INSTALL_TARGET  = $(UNIX_BIN) $(ROOTMODULE) $(BOOT_MODULE)
  70 
  71 #
  72 #       This is UNIX_DIR. Use a short path.
  73 #
  74 UNIX_DIR        = .
  75 
  76 #
  77 #       Overrides
  78 #
  79 CLEANFILES      += $(OBJECTS) \
  80                    $(UNIX_O)
  81 
  82 CLOBBERFILES    = $(CLEANFILES) $(UNIX_BIN)
  83 
  84 CFLAGS += $(CCVERBOSE)
  85 
  86 CERRWARN        += -_gcc=-Wno-parentheses
  87 CERRWARN        += -_gcc=-Wno-uninitialized
  88 CERRWARN        += -_gcc=-Wno-unused-label
  89 CERRWARN        += -_gcc=-Wno-unused-function
  90 CERRWARN        += -_gcc=-Wno-unused-variable
  91 CERRWARN        += -_gcc=-Wno-unused-but-set-variable
  92 
  93 # The mapfile used to link unix
  94 MAPFILE         = $(UTSBASE)/armv6/bcm2835/conf/Mapfile
  95 
  96 # Tools to build the platform and loader kernel.
  97 MKPLATFORM      = $(UTSBASE)/$(PLATFORM)/tools/mkplatform
  98 MKUNI           = $(UTSBASE)/$(PLATFORM)/tools/mkuni
  99 
 100 #
 101 #       Default build targets.
 102 #
 103 .KEEP_STATE:
 104 
 105 def:            $(DEF_DEPS)
 106 
 107 all:            $(ALL_DEPS)
 108 
 109 clean:          $(CLEAN_DEPS)
 110 
 111 clobber:        $(CLOBBER_DEPS)
 112 
 113 install:        $(INSTALL_DEPS) $(MKPLATFORM) $(MKUNI)
 114 
 115 symcheck:       $(SYM_DEPS)
 116 
 117 $(UNIX_BIN): $(UNIX_O) $(MAPFILE) $(LIBS) $(DTRACESTUBS)
 118         $(LD) -dy -b -znointerp -o $@ -e _start -M $(MAPFILE) \
 119             $(UNIX_O) $(LIBOPTS) $(DTRACESTUBS)
 120         $(CTFMERGE_UNIQUIFY_AGAINST_GENUNIX)
 121         $(POST_PROCESS)
 122 
 123 $(UNIX_O):      $(OBJECTS) $(OBJS_DIR)/vers.o
 124         $(LD) -r -o $@ $(OBJECTS) $(OBJS_DIR)/vers.o
 125 
 126 symcheck.targ:  $(UNIX_O) $(KRTLD_O) $(MODSTUBS_O) $(LIBS) $(DTRACESTUBS) 
 127         $(LD) -dy -b -o $(SYM_MOD) -M $(MAPFILE) \
 128         $(UNIX_O) $(KRTLD_O) $(MODSTUBS_O) $(LIBOPTS) $(DTRACESTUBS) 
 129 
 130 $(KRTLD_O):     $(KRTLD_OBJECTS)
 131         $(LD) -r -o $@ -M$(KRTLD_MAPFILE) $(KRTLD_OBJECTS)
 132 
 133 $(MKPLATFORM) $(MKUNI):
 134         cd ../../tools && pwd && dmake
 135 
 136 $(INITRD_BIN): $(MKPLATFORM) $(MKUNI) $(UNIX_BIN) $(GENUNIX_DIR)/$(OBJS_DIR)/$(GENUNIX)
 137         pfexec $(MKPLATFORM) -u $(ROOT_BCM2835_MOD_DIR:$(ROOT)/%=/%) $(UNIX_BIN) \
 138             $(GENUNIX_DIR)/$(OBJS_DIR)/$(GENUNIX)
 139         $(MV) $(ARCHIVE) $(OBJS_DIR)/
 140         $(MKUNI) $(UNIX_BIN) $(OBJS_DIR)/$(ARCHIVE) $(OBJS_DIR)/$(INITRD)
 141 
 142 #
 143 #       Include common targets.
 144 #
 145 include $(UTSBASE)/armv6/bcm2835/Makefile.targ