blob: 57cfe2a70b536f8c916a2e9f8efc1945ebaab3fb [file] [log] [blame]
#
# @(#)Rules.gmk 1.3 97/10/23
#
# Rules shared by all Java makefiles.
#
.PHONY: classes
include $(TOPDIR)/build/$(PLATFORM)/makefiles/Defs.gmk
#
# This could now be done with vpaths.
#
$(CLASSBINDIR)/%.class: $(PLATFORM_SRC)/classes/%.java
@echo $? >>.classes.list
$(CLASSBINDIR)/%.class: $(SHARE_SRC)/classes/%.java
@echo $? >>.classes.list
FILES_class = $(FILES_java:%.java=$(CLASSBINDIR)/%.class)
.delete.classlist:
@/bin/rm -f .classes.list
.compile.classlist:
if [ -s .classes.list ] ; \
then $(JAVAC_CMD) -classpath $(CLASSPATH) -d $(CLASSBINDIR) \
$(JAVACFLAGS) \
$(shell if [ -s .classes.list ] ; then cat .classes.list; fi ) ; \
fi
classes : $(CLASSBINDIR) .delete.classlist $(FILES_class) .compile.classlist
#
# Special rules to collect the list of source files in this project.
# The leading "X/" is a necessary hack because otherwise "%.class"
# doesn't match anything with a "/" in it.
#
X/%.class: $(PLATFORM_SRC)/classes/%.java
@echo $? >>.classes.prj
X/%.class: $(SHARE_SRC)/classes/%.java
@echo $? >>.classes.prj
FILES_list = $(FILES_java:%.java=X/%.class)
#
# Rules for making Java Workshop project files
#
project :: .delete.prjlist $(FILES_list)
.delete.prjlist:
@/bin/rm -f .classes.prj
include $(TOPDIR)/build/$(PLATFORM)/makefiles/Project.gmk
# End of Java Workshop rules
$(CLASSBINDIR):
@mkdir -p $@
$(OBJDIR)/%.o: %.c
ifdef VARIANT
$(COMPILE.c) -o $@ $<
@$(CC) -xM1 $(CPPFLAGS) $< 2> /dev/null | \
sed -e '/:[ ]*[/]/d' -e 's!$*\.o!$(dir $@)&!g' | \
sort | uniq > $(@:.o=.d)
else
$(MAKE) $@ VARIANT=OPT
endif
$(OBJDIR_NAME)$(DBG_SUFFIX)/$(ARCH)/$(TSOBJDIR)/%.o: %.c
ifdef VARIANT
$(COMPILE.c) -o $@ $<
@$(CC) -xM1 $(CPPFLAGS) $< 2> /dev/null | \
sed -e '/:[ ]*[/]/d' -e 's!$*\.o!$(dir $@)&!g' | \
sort | uniq > $(@:.o=.d)
else
$(MAKE) $@ VARIANT=DBG
endif
$(OBJDIR_NAME)/$(ARCH)/$(TSOBJDIR)/%.o: %.cpp
$(COMPILE.cc) -o $@ $<
$(OBJDIR_NAME)$(DBG_SUFFIX)/$(ARCH)/$(TSOBJDIR)/%.o: %.cpp
$(COMPILE.cc) -o $@ $<
$(OBJDIR_NAME)/$(ARCH)/$(TSOBJDIR)/%.o: %.s
$(COMPILE.s) -o $@ $<
$(OBJDIR_NAME)$(DBG_SUFFIX)/$(ARCH)/$(TSOBJDIR)/%.o: %.s
$(COMPILE.s) -o $@ $<
#
# Special targets and dependencies
#
opcodes.h: $(SHARE_SRC)/javavm/include/opcodes.list
@echo "Creating $@ ... "
@rm -f $@
@awk 'BEGIN {print "typedef enum {" } \
/^[a-z]/ {printf(" opc_%s = %d,\n", $$1, i++); } \
END {printf(" opc_first_unused_index = %d,\n", i++); \
print " opc_software = 254,"; \
print " opc_hardware = 255"; \
print "} opcode_type;"; \
}' \
$(SHARE_SRC)/javavm/include/opcodes.list > $@
@chmod 444 $@
opcodes.init: $(SHARE_SRC)/javavm/include/opcodes.list
@echo "Creating $@ ... "
@rm -f $@
@awk 'BEGIN { print "char *opnames[256] = {" } \
/^[a-z]/ { printf(" \"%s\",\n", $$1); i++; } \
END { while(i++ < 254) print " \"??\","; \
print " \"software\","; \
print " \"hardware\","; \
print "};" \
}' \
$(SHARE_SRC)/javavm/include/opcodes.list > $@
@chmod 444 $@
opcodes.c: $(SHARE_SRC)/javavm/include/opcodes.list
@echo "Creating $@ ... "
@rm -f $@
@awk 'BEGIN { \
print "#if defined(TRACING) || defined(STATISTICS)"; \
print "char *opnames[256] = {"; \
} \
/^[a-z]/ { printf(" \"%s\",\n", $$1); i++; } \
END { \
while(i++ < 254) \
print " \"??\","; \
print " \"software\","; \
print " \"hardware\","; \
print "};"; \
print "#else "; \
print "char *opnames[1];"; \
print "#endif"; \
} \
' \
$(SHARE_SRC)/javavm/include/opcodes.list > $@
@chmod 444 $@
opcodes.length: $(SHARE_SRC)/javavm/include/opcodes.list
@echo "Creating $@ ... "
@rm -f $@
@awk 'BEGIN { print "short opcode_length[256] = {" } \
/^[a-z]/ { printf(" %s,\t\t/* %s */\n", $$2, $$1); i++; } \
END { while(i++ < 256) print " -1,"; print "};" }' \
$(SHARE_SRC)/javavm/include/opcodes.list > $@
@chmod 444 $@
opcodes.in_out: $(SHARE_SRC)/javavm/include/opcodes.list
@echo "Creating $@ ... "
@rm -f $@
@awk 'BEGIN { print "char *opcode_in_out[][2] = {" } \
/^[a-z]/ { if ($$3 == "-") $$3 = ""; \
if ($$4 == "-") $$4 = ""; \
printf(" {\"%s\", \"%s\"}, \t\t/* %s */\n", \
$$3, $$4, $$1); } \
END { print "};" }' \
$(SHARE_SRC)/javavm/include/opcodes.list > $@
@chmod 444 $@
clobber :: clean
FORCE: ;
.PHONY : .delete.classlist classes .compile.classlist clean clobber
debug:
$(MAKE) $(DEBUG) VARIANT=DBG
optimized:
$(MAKE) $(OPTIMIZED) VARIANT=OPT