+/EE312

software design

git clone https://git.julia.blue/+/EE312

Joseph RyanProject 3acb4676

master
1.2 KiB78 linesraw
1# New Makefile that automatically depends itself
2#
3#
4
5IFLAGS = 
6DFLAGS = 
7CXX = g++
8CC  = $(GCC)
9GCC = g++
10LD  = $(CXX)
11
12LIBS = 
13
14WFLAGS = -Wall 
15SYMFLAGS = -g
16
17PROFILE = #-pg 
18OPTFLAGS =#-O
19CFLAGS = $(OPTFLAGS) $(PROFILE) $(WFLAGS) $(IFLAGS) $(SYMFLAGS)
20CXXFLAGS = $(CFLAGS)
21CPPFLAGS = $(IFLAGS) $(DFLAGS)
22LDFLAGS = $(PROFILE) -g 
23
24PROGRAM = proj2
25#CXXSRCS = Source.cpp
26
27CXXSRCS = $(shell ls *.cpp)
28          
29
30SRCS = $(CXXSRCS) 
31
32OBJS = $(CXXSRCS:.cpp=.o)
33
34all: $(PROGRAM)
35
36$(PROGRAM): $(OBJS)
37	$(LD) -o $@ $(LDFLAGS) $(OBJS) $(LIBS)
38
39test: $(PROGRAM)
40	./$(PROGRAM)
41
42clean:
43	-rm -f $(OBJS) $(PROGRAM)
44
45tidy:
46	-rm -f *.BAK *.bak *.CKP
47
48undepend:
49	-rm -f $(OBJS:%.o=.%.d) 
50
51spotless: tidy clean undepend
52
53.y.cpp:
54	$(BISON) $(BISONFLAGS) -o $@ $<
55	mv $@.h $*.h
56	mv $@.output $*.output
57.l.cpp:
58	$(FLEX) ${FLEXFLAGS} -t $< > $@
59
60# auto depend stuff for GNU make only
61depend: undepend
62	@echo ""
63	@echo "Dependences are handled automatically, just \"make\""
64
65ifneq ($(strip $(CSRCS)),)
66.%.d: %.c 
67	$(SHELL) -ec '$(GCC) -MM $(CPPFLAGS) $< > $@'
68
69
70include $(CSRCS:%.c=.%.d)
71endif 
72
73ifneq ($(strip $(CXXSRCS)),)
74.%.d: %.cpp
75	$(SHELL) -ec '$(GCC) -MM $(CPPFLAGS) $< > $@'
76
77include $(CXXSRCS:%.cpp=.%.d) 
78endif