Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Unix Makefile

Posted on 1998-07-31
2
226 Views
Last Modified: 2010-03-30
Does anyone have a Unix Makefile that will compile both JAVA and C/C++.

Thanks in advance!
0
Comment
Question by:jefftk
2 Comments
 
LVL 2

Accepted Solution

by:
shchuka earned 50 total points
ID: 1229634
This is relatively simple.  Assuming that your path and classpath are set correctly...

#Makefile starts here
JAVAC = javac
CC = gxx
JAVAFLAGS = whatever parameters you need
CFLAGS = whatever parameters you need
LDFLAGS = whatever you need
CPROGRAMNAME = name of your cpp output file

all: javafiles cppfiles
    #do whatever you need with them together after each part is compiled

javafiles: class1 class2

cppfiles: cprograms

class1: class1.java
    $(JAVAC) $(JAVAFLAGS) class1.java

class2: class2.java
    $(JAVAC) $(JAVAFLAGS) class2.java

cppfiles: file1.o file2.o
    $(CC) $(LDFLAGS) -o $(CPROGRAMNAME) file1.o file2.o

file1.o file1.c file1.h
    $(CC) -c $(CFLAGS) file1.c

file2.o file2.c file2.h
    $(CC) -c $(CFLAGS) file2.c

#End of make file
0
 

Author Comment

by:jefftk
ID: 1229635
Thank you.
I will try to implement this code.


0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Apps blocked by Java 9 88
how to add new optional parameter to JSP 1 49
Java: anonymous class 4 29
Java program running SQL query 5 37
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question