makefile question?

I'm doing a project and using different assignments.
For one assignment I made a makefile.
Now I'm doing another assignment that has to do with adding to the next assignment, then I have to make another makefile.
How should I do this? It's all in the same directory, can I make another Makefile?
Or do I have to just edit the one I already have?
You could, but then you'd have to have to specify which one you want to use with make.

I'd probably just rename the old one to something like "assign_old_makefile" or what have you.
closed account (iw0XoG1T)
here is an example of a generic makefile that will make almost anything--maybe it will help.
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
APP      = test

OBJDIR   = obj

SRCS     = $(wildcard *.cpp)
SRCDIRS  = ./
OBJS     = $(patsubst %.cpp,$(OBJDIR)/%.o,$(SRCS))
DEPS     = $(patsubst %.cpp,$(OBJDIR)/%.d,$(SRCS))
INCLUDE  = 
DEBUG    = 
CXXFLAGS = $(INCLUDE) $(DEBUG) -std=c++11 -Wall -pedantic -MMD -MP

LDFLAGS  = 
LIBS     = 

.PHONY: all clean

 
all : makerepo $(APP) 
     
$(APP) : $(OBJS)  
	$(CXX) $(LDFLAGS) $^ $(LIBS) -o $@ 
 
$(OBJDIR)/%.o : %.cpp
	$(CXX) $(CXXFLAGS) -c $< -o $@ 
 
clean :
	$(RM) -r $(OBJDIR)

makerepo :
	@mkdir -p $(OBJDIR)

ifeq (,$(findstring clean,$(MAKECMDGOALS)))
-include $(DEPS)
endif
Topic archived. No new replies allowed.