Makefile to compile both C and Java programs at the same time

Posted by user342745 on Stack Overflow See other posts from Stack Overflow or by user342745
Published on 2010-05-17T04:42:12Z Indexed on 2010/05/17 5:00 UTC
Read the original article Hit count: 218

Filed under:
|
|
|
|

I have three programs that need to be compiled at the same time, 2 written in C and 1 in java. I had all three working with the Makefile when they were in C, but then switched one of them to java... is there a way to compile all 3 at once with the same makefile?

Here is my current Makefile:

CC=gcc 
JC=javac 
JFLAGS= -g
CFLAGS= -Wall -g -std=c99
LDFLAGS= -lm
.SUFFIXES: .java .class
.java.class:
 $(JC) $(JFLAGS) $*.java

CLASSES = kasiski.java kentry.java

ALL= ic ftable kasiski

all: $(ALL)

ic: ic.o

kasiski: $(CLASSES:.java=.class)

ftable: ftable.o

ic.o: ic.c ic.h

ftable.o: ftable.c ftable.h

.PHONY: clean

clean:
 rm -rf core* *.class *.o *.gch $(ALL)

© Stack Overflow or respective owner

Related posts about makefile

Related posts about make