X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fruntime%2FGNUmakefile;h=3d75800b06431eeb18fdf8e694d47c9c1518ac62;hb=0e3c4b4db102bd204a30402d7e5a0de44aea57ce;hp=bf32c7a324f7a6be0a37aa165f149c83a3e88dfb;hpb=dc5e3163fe667e2629c7769aa8cf2e501eeeefa6;p=sbcl.git diff --git a/src/runtime/GNUmakefile b/src/runtime/GNUmakefile index bf32c7a..3d75800 100644 --- a/src/runtime/GNUmakefile +++ b/src/runtime/GNUmakefile @@ -1,4 +1,4 @@ -# makefile for the C-level run-time support for SBCL +# -*- makefile -*- for the C-level run-time support for SBCL # This software is part of the SBCL system. See the README file for # more information. @@ -9,59 +9,85 @@ # provided with absolutely no warranty. See the COPYING and CREDITS # files for more information. -all: sbcl sbcl.nm -.PHONY: all +.PHONY: all clean TAGS tags targets -# defaults which might be overridden or modified by values in the -# Config file -CFLAGS = -g -Wall -O3 -ASFLAGS = $(CFLAGS) -DEPEND_FLAGS = -CPPFLAGS = -I. +all: targets tags +TARGET=sbcl -# Some of these things might be Config-dependent in future versions, -# but they're the same on most systems right now. If you need to -# override one of these, do it in Config -CPP = cpp +# Defaults which might be overridden or modified by values in the +# Config file. Most of them are same on most systems right now. +# If you need to override one of these, do it in Config. LD = ld LINKFLAGS = -g NM = nm -gp -DEPEND_FLAGS=-M +DEPEND_FLAGS = -MM +GREP = grep + +include ../../output/prefix.def + +CFLAGS = -g -Wall -Wsign-compare -O3 +ASFLAGS = $(CFLAGS) +CPPFLAGS = -I. -DSBCL_PREFIX=\"$(SBCL_PREFIX)\" + +# Give make access to the target Lisp features. +include genesis/Makefile.features # The Config file is the preferred place for tweaking options which -# are appropriate for particular setups (OS, CPU, whatever). Make a +# are appropriate for particular setups (OS, ARCH, whatever). Make a # Config-foo file for setup foo, then arrange for Config to be a # symlink to Config-foo. +# Commonly used variables in Config are: ARCH_SRC, ASSEM_SRC, GC_SRC, +# OS_SRC, OS_LIBS, OS_OBJS, OS_CLEAN_FILES include Config +COMMON_SRC = alloc.c backtrace.c breakpoint.c coreparse.c \ + dynbind.c funcall.c gc-common.c globals.c interr.c interrupt.c \ + largefile.c monitor.c os-common.c parse.c print.c purify.c \ + pthread-futex.c \ + regnames.c run-program.c runtime.c safepoint.c save.c search.c \ + thread.c time.c util.c validate.c vars.c wrap.c -C_SRCS =alloc.c backtrace.c breakpoint.c coreparse.c \ - dynbind.c globals.c interr.c interrupt.c \ - monitor.c parse.c print.c purify.c \ - regnames.c run-program.c runtime.c save.c search.c \ - time.c util.c validate.c vars.c wrap.c +C_SRC = $(COMMON_SRC) ${ARCH_SRC} ${OS_SRC} ${GC_SRC} -SRCS= $(C_SRCS) ${ARCH_SRC} ${ASSEM_SRC} ${OS_SRC} ${GC_SRC} +SRCS = $(C_SRC) ${ASSEM_SRC} -OBJS = $(patsubst %.c,%.o,$(patsubst %.S,%.o,$(patsubst %.s,%.o,$(SRCS)))) +OBJS = $(C_SRC:.c=.o) $(ASSEM_SRC:.S=.o) ${OS_OBJS} -sbcl.nm: sbcl - $(NM) sbcl | grep -v " F \| U " > ,$@ - mv -f ,$@ $@ +LIBS = ${OS_LIBS} -lm -sbcl: ${OBJS} - $(CC) ${LINKFLAGS} ${OS_LINK_FLAGS} -o $@ ${OBJS} ${OS_LIBS} -lm +targets: $(TARGET) sbcl.nm +$(TARGET): $(OBJS) + $(CC) ${LINKFLAGS} -o $@ $^ $(LIBS) -.PHONY: clean all -clean: - -rm -f depend *.o sbcl sbcl.nm core *.tmp +sbcl.nm: $(TARGET) + $(NM) $(TARGET) | $(GREP) -v " [FUw] " > ,$@ + mv -f ,$@ $@ +sbcl.h: $(wildcard genesis/*.h) + echo '#include "genesis/config.h"' >sbcl.h + echo '#include "genesis/constants.h"' >>sbcl.h -depend: ${C_SRCS} sbcl.h - $(CC) ${DEPEND_FLAGS} ${CFLAGS} ${CPPFLAGS} ${C_SRCS} > depend.tmp - mv -f depend.tmp depend +# || true because we don't want the build to break if etags isn't there. +# ...but it's still nice to have it done by default. +TAGS tags: $(SRCS) + etags $(SRCS) || true -# By including this file, we cause GNU to automatically make depend if -# it can't find it or it is out of date -include depend +clean: + -rm -f *.[do] $(TARGET) sbcl.nm sbcl.h core *.tmp $(OS_CLEAN_FILES) + +%.d: %.c sbcl.h + @$(CC) $(DEPEND_FLAGS) $(CPPFLAGS) $< > $@.tmp; \ + sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.tmp > $@; \ + rm -f $@.tmp + +%.d: %.S sbcl.h + @$(CC) $(DEPEND_FLAGS) $(CPPFLAGS) $< > $@.tmp; \ + sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.tmp > $@; \ + rm -f $@.tmp + +# By including those files, we cause GNU make to automatically re-make +# all dependencies of the .c file if necessary. +ifneq ($(MAKECMDGOALS),clean) +-include $(C_SRC:.c=.d) $(ASSEM_SRC:.S=.d) +endif