vx32

Local 9vx git repository for patches.
git clone git://r-36.net/vx32
Log | Files | Refs

Makefrag (2622B)


      1 # Main top-level makefile fragment for the vx32 virtual machine.
      2 
      3 # Compiler flags common to both host and VX32 environment files.
      4 COMMON_CFLAGS = -m32  -g -O2 -MD -std=gnu99 -I. -fno-stack-protector $(CFLAGS) -DARCH=i386
      5 COMMON_LDFLAGS = -g -L. $(LDFLAGS)
      6 
      7 ifeq ($(OS),darwin)
      8 	COMMON_CFLAGS += -m32 -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -DARCH=i386
      9 	COMMON_LDFLAGS += -m32
     10 endif
     11 
     12  # Host environment compiler options
     13 HOST_CC		:= $(CC) -fno-inline -m32  -DARCH=i386
     14 ifeq ($(OS),darwin)
     15 	HOST_CC		:= $(HOST_CC)  -D_XOPEN_SOURCE
     16 endif
     17 HOST_LD		:= $(LD) -arch i386
     18 HOST_AR		:= $(AR)
     19 HOST_LDFLAGS	:= $(COMMON_LDFLAGS)
     20 HOST_CFLAGS	:= $(COMMON_CFLAGS)
     21 
     22 # VX32 environment compiler options
     23 # If you build your own vx32-specific copies of the GNU
     24 # tools (see README), you can refer to them here. 
     25 # On most x86 systems, though, the standard gcc is fine.
     26 # VX32_CC		:= vx32-gcc
     27 # VX32_LD		:= vx32-ld
     28 # VX32_AR		:= vx32-ar
     29 # VX32_OBJCOPY	:= vx32-objcopy
     30 VX32_CC		:= gcc -m32
     31 VX32_LD		:= ld -melf_i386
     32 VX32_AR		:= ar
     33 VX32_OBJCOPY	:= objcopy
     34 
     35 VX32_CFLAGS := -nostdinc -Ilibvxc/include $(COMMON_CFLAGS)
     36 VX32_CFLAGS += $(shell $(VX32_CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
     37 
     38 VX32_LDFLAGS := -Llibvxc -L$(dir $(shell $(VX32_CC) -print-libgcc-file-name)) \
     39 		$(COMMON_LDFLAGS) libvxc/vx32/crt0.o
     40 VX32_LDLIBS := -lc -lgcc
     41 
     42 # Set compiler options if we should generate x87 FPU code.
     43 HAVE_X87 = yes
     44 ifdef HAVE_X87
     45 VX32_CFLAGS += -m80387 -mfp-ret-in-387
     46 endif
     47 
     48 
     49 INSTALL = install
     50 
     51 # there's only one thing we really care about. 9vx
     52 9vx/9vx:
     53 # Make sure that 'all' is the first target
     54 all: 
     55 
     56 # Install libvx32 too
     57 install: 9vx/install libvxc/install vxlinux/install vxrun/install
     58 
     59 # Eliminate default suffix rules
     60 .SUFFIXES:
     61 
     62 # Delete target files if there is an error (or make is interrupted)
     63 .DELETE_ON_ERROR:
     64 
     65 
     66 # Include Makefrags for subdirectories
     67 include libvxc/Makefrag
     68 include libvx32/Makefrag
     69 include vxrun/Makefrag
     70 include vxlinux/Makefrag
     71 include vxa/Makefrag		# VXA decoders
     72 include hash/Makefrag		# cryptographic hash algorithms
     73 include micro/Makefrag		# microbenchmarks
     74 include 9vx/Makefrag	# Plan 9 VX
     75 include test/Makefrag		# vx32 tests
     76 
     77 DEPS_FILES := $(wildcard */*.d */*/*.d */*/*/*.d)
     78 CLEAN_FILES += .deps $(DEPS_FILES)
     79 
     80 clean:
     81 	rm -f $(CLEAN_FILES)
     82 
     83 # This magic automatically generates makefile dependencies
     84 # for header files included from C source files we compile,
     85 # and keeps those dependencies up-to-date every time we recompile.
     86 # See 'mergedep.pl' for more information.
     87 .deps: $(DEPS_FILES)
     88 	@mkdir -p $(@D)
     89 	@$(PERL) $(top_srcdir)/mergedep.pl $@ $^
     90 
     91 -include .deps
     92