[SqNOS] Compiling

Gerardo Richarte gera at corest.com
Sat Jun 17 14:05:21 UTC 2006


>
> > Now, "make distro" may fail, if so, or if you prefer try "make iso"
> > instead, this'll leave SqueakNOS.iso in release and may be enough for you.
> >   
>   

The attached version of the Makefile (to put in platforms/SqueakNOS)
will solve the problems related to "make distro" and is actually a lot
lot cleaner than the ugly hack I was doing before.

Craig: this should fix you make distro problems

    thanks for testing!
    gera

-------------- next part --------------
ifndef SRCDIR
include src32/plugins.ext
include src32/plugins.int

INTERNAL_LIBS = $(addsuffix .lib, $(INTERNAL_PLUGINS))
EXTERNAL_LIBS = $(addsuffix .dll, $(EXTERNAL_PLUGINS))
endif

VM       = SqueakNOS.obj
VMOUTDIR = $(BLDDIR)
SQIMAGE  = Squeak3.8-6665full

all: $(VM)

try: all
	cp $(VMOUTDIR)/$(VM) boot/SqueakNOS.o
	make -C boot SqueakNOS.try

iso: all
	cp $(SQIMAGE).* boot/iso.template
	cp $(VMOUTDIR)/$(VM) boot/SqueakNOS.o
	make -C boot SqueakNOS.iso SqueakNOS.cd.vmx
	mv boot/SqueakNOS.iso $(BLDDIR)
	mv boot/SqueakNOS.cd.vmx $(BLDDIR)/SqueakNOS.vmx

distro:
	make clean
	make -C boot clean
	rm -rf boot/iso.template/$(SQIMAGE).*
	rm -rf boot/iso.template/trunk
	cd ../../../ && tar --exclude $(SQIMAGE).\* -cvf sources.tar trunk/platforms/SqueakNOS trunk/platforms/Cross
	cd boot/iso.template && tar xvf ../../../../../sources.tar
	rm ../../../sources.tar
	make iso
	cd $(BLDDIR) && tar cjvf SqueakNOS-`date +%d-%b-%Y`.tar.bz2 SqueakNOS.iso SqueakNOS.vmx
	cd $(BLDDIR) && zip -9 SqueakNOS-`date +%d-%b-%Y`.zip SqueakNOS.iso SqueakNOS.vmx

AR = ar
CP = cp
RM = rm
LD = ld

CFLAGS = -g -mpentium -O0 -fomit-frame-pointer -funroll-loops -fschedule-insns2
LDFLAGS = -static -nostdlib -lm -Xlinker -r
CXXFLAGS= $(CFLAGS) -felide-constructors
DEFS  = -DNO_STD_FILE_SUPPORT -DDEBUG -DLSB_FIRST -DX86 $(XDEFS)
XDEFS = -DSQUEAK_BUILTIN_PLUGIN

ifndef SRCDIR
SRCDIR=.
endif
BLDDIR= $(SRCDIR)/release

ifndef OBJDIR
OBJDIR= $(BLDDIR)
endif

VMDIR1 = $(SRCDIR)/src32/vm
VMDIR2 = $(SRCDIR)/../Cross/vm
VMDIR3 = $(SRCDIR)/common
VMDIR4 = $(SRCDIR)/nos
VMSRC = $(notdir $(wildcard $(VMDIR1)/*.c) $(wildcard $(VMDIR2)/*.c) $(wildcard $(VMDIR3)/*.c) $(wildcard $(VMDIR4)/*.c))
VMOBJ:=	$(VMSRC:.c=.o)
INCS =-I$(VMDIR1) -I$(VMDIR2) -I$(VMDIR3) -I$(VMDIR4)

LIBSRC = $(wildcard *.c)
LIBOBJ = $(LIBSRC:.c=.o)

LIBCOBJS = strcpy.o strncmp.o strcmp.o strlen.o memcpy.o memcmp.o

ALLOBJ=		$(VMOBJ) libc.o


# Where to look for files?
VPATH=		$(VMDIR1) $(VMDIR2) $(VMDIR3) $(VMDIR4) $(VMOUTDIR)

.SUFFIXES:
.SUFFIXES:	.ccg .cc .c .o .s .i .rc .res .cg .hg .ccg
.INTERMEDIATE: unix.c nos.c

$(VM): .ensureRelease $(ALLOBJ) $(INTERNAL_LIBS) 
		$(CC) -o $(VMOUTDIR)/$@ $(addprefix $(VMOUTDIR)/,$(ALLOBJ)) $(addprefix $(VMOUTDIR)/,$(INTERNAL_LIBS)) $(LDFLAGS) 

# Building plugins

makelib: $(LIBOBJ) 
	$(AR) rc $(LIB) $(LIBOBJ)
	$(RM) $(LIBOBJ)

%.lib:
	@$(MAKE) -C src32/vm/intplugins/$* -f ../../../../Makefile SRCDIR=../../../.. LIB=$*.lib OBJDIR=. XDEFS=-DSQUEAK_BUILTIN_PLUGIN makelib
	$(CP) src32/vm/intplugins/$*/$*.lib $(BLDDIR)/$*.lib
	$(RM) src32/vm/intplugins/$*/$*.lib

# Rules for automated builds

.c.o: 
	$(CC) -o $(OBJDIR)/$@ $(CFLAGS) $(INCS) $(DEFS) -c $<

.cc.o:
	$(CXX) -o $(OBJDIR)/$@ $(CXXFLAGS) $(INCS) $(DEFS) -c $<

.c.s:
	$(CC) -S -o $@ -fverbose-asm -Wa,ah $(CFLAGS) $(INCS) $(DEFS) -c $<

.cc.s:
	$(CXX) -S -o $@ -fverbose-asm -Wa,ah $(CXXFLAGS) $(INCS) $(DEFS) -c $<

.c.i:
	$(CC) -E -o $@ $(CFLAGS) $(INCS) $(DEFS) -c $<

.cg.c:
	$(CCG) -n -o $@ $<

.hg.h:
	$(CCG) -n -o $@ $<

.ccg.cc:
	$(CCG) -n -o $@ $<

# Extra specific dependencies

libc.o: /usr/lib/libc.a
	cd $(OBJDIR)
	$(AR) x $< $(LIBCOBJS)
	ld -r -o $(BLDDIR)/$@ $(LIBCOBJS)
	$(RM) $(LIBCOBJS)

.ensureRelease:
	mkdir -p $(BLDDIR)

### housekeeping
clean:
	make -C boot clean
	-rm -f $(BLDDIR)/* *.iso *.vmx


More information about the SqueakNOS mailing list