Skip to content

Instantly share code, notes, and snippets.

@Dnomyar
Last active August 29, 2015 14:13
Show Gist options
  • Save Dnomyar/d01d886731ccc88d3c63 to your computer and use it in GitHub Desktop.
Save Dnomyar/d01d886731ccc88d3c63 to your computer and use it in GitHub Desktop.
Makefile JAVA
SRC = src
SOURCES = $(shell find ./src/ -name *.java)
S = java
SC = javac
TARGET = bin
CP = bin
VPATH=bin
run: compile
@echo ":: Executing..."
@$(S) -cp $(CP) App
compile: $(SOURCES:.%.java=.%.class)
%.class: %.java
clear
@echo ":: Compiling..."
@echo "Compiling $*.java.."
@# Little bit ugly but it's works. If you have another solution, don't hesitate to contact me.
@if [ $(shell stat -c %Y $*.java) -lt $(shell stat -c %Y $(shell echo "$*.class" | sed 's/src/bin/g')) ]; then echo ; else $(SC) -sourcepath $(SRC) -cp $(CP) -d $(TARGET) -encoding utf-8 $*.java; fi
clean:
@rm -R bin/*
# Pour supprimer les fichier .fuse* créés par sublime text
fuse:
@rm `find -name "*fuse*"`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment