Makefile 1.14 KB
Newer Older
Florian Lugou's avatar
Florian Lugou committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
PREFIX			= [LAUNCHER]         

MANIFEST		= $(LAUNCHER_DIR)/manifest.txt

DEPEND			= $(patsubst %,$(TTOOL_BIN)/%,$(shell cat $(MANIFEST) | grep Class-Path | cut -d: -f2))

LOCAL_SRC_DIR		= $(LAUNCHER_DIR)/src/main/java
LOCAL_BUILD_DIR		= $(LAUNCHER_DIR)/build/classes/main

LOCAL_JAVA	= $(shell cd $(LOCAL_SRC_DIR); find . -name "*.java")
LOCAL_CLASS	= $(patsubst %.java,%.class,$(LOCAL_JAVA))

CFLAGS		= $(GLOBAL_CFLAGS) -sourcepath $(TTOOL_SRC):$(LOCAL_SRC_DIR) -classpath $(TTOOL_CLASSPATH) -d $(LOCAL_BUILD_DIR)
JARFLAGS	= cmf
JARRSRCFLAGS	= uf

.PHONY: compile clean

$(LAUNCHER_BINARY): compile $(DEPEND)
	@echo "$(PREFIX) Archiving"
	@mkdir -p $(TTOOL_BIN)
	@$(JAR) $(JARFLAGS) $(MANIFEST) $@ -C $(LOCAL_BUILD_DIR) .
ifneq ($(strip $(LOCAL_RESOURCES_DIR)),)
	@$(JAR) $(JARRSRCFLAGS) $@ -C $(LOCAL_RESOURCES_DIR) .
endif

$(TTOOL_BIN)/%.jar: $(TTOOL_LIBS)/%.jar
	@mkdir -p $(TTOOL_BIN)
	@cp $< $@

compile: $(patsubst %,$(LOCAL_SRC_DIR)/%,$(LOCAL_JAVA)) $(patsubst %,$(TTOOL_SRC)/%,$(GLOBAL_JAVA))
	@echo "$(PREFIX) Compiling"
	@mkdir -p $(LOCAL_BUILD_DIR)
	@$(JAVAC) $(CFLAGS) $(patsubst %,$(LOCAL_SRC_DIR)/%,$(LOCAL_JAVA))

clean:
	@rm -rf $(LOCAL_BUILD_DIR)