c2b0e5033b147afc99363374f1eb482745107cf6
[fw/sdcc] / Makefile
1 #
2 #
3 #
4
5 SHELL           = /bin/sh
6 AUTOCONF        = autoconf
7
8 PRJDIR          = .
9 PKGS            = support/gc support/cpp \
10                   src as/mcs51 debugger/mcs51 \
11                   device/include device/lib sim/mcs51
12 PRJS            = sim/mcs51
13
14 srcdir          = .
15
16
17 # Compiling entire program or any subproject
18 # ------------------------------------------
19 all: checkconf
20         for pkg in $(PKGS); do $(MAKE) -C $$pkg; done
21         $(MAKE) -f main.mk all
22
23
24 # Compiling and installing everything and runing test
25 # ---------------------------------------------------
26 install:
27         $(MAKE) -f main.mk install
28         @for pkg in $(PKGS); do\
29           CURDIR=`pwd`;\
30           cd $$pkg && $(MAKE) install; cd $(CURDIR);\
31         done
32
33
34 # Deleting all the installed files
35 # --------------------------------
36 uninstall:
37         $(MAKE) -f main.mk uninstall
38         @for pkg in $(PKGS); do\
39           CURDIR=`pwd`;\
40           cd cmd && $(MAKE) uninstall; cd $(CURDIR);\
41         done
42
43
44 # Deleting all files created by building the program
45 # --------------------------------------------------
46 clean:
47         $(MAKE) -f clean.mk clean
48         for pkg in $(PKGS); do $(MAKE) -C $$pkg clean; done
49         @for prj in $(PRJS); do\
50           CURDIR=`pwd`;\
51           cd $$prj && $(MAKE) clean; cd $(CURDIR);\
52         done
53
54
55 # Deleting all files created by configuring or building the program
56 # -----------------------------------------------------------------
57 distclean: clean
58         $(MAKE) -f clean.mk distclean
59         @for pkg in $(PKGS); do\
60           CURDIR=`pwd`;\
61           cd $$pkg && $(MAKE) -f clean.mk distclean; cd $(CURDIR);\
62         done
63         @for prj in $(PRJS); do\
64           cd $$prj && $(MAKE) distclean; cd ..;\
65         done
66
67
68 # Like clean but some files may still exist
69 # -----------------------------------------
70 mostlyclean: clean
71         $(MAKE) -f clean.mk mostlyclean
72         @for pkg in $(PKGS); do\
73           CURDIR=`pwd`;\
74           cd $$pkg && $(MAKE) -f clean.mk mostlyclean; cd $(CURDIR);\
75         done
76         @for prj in $(PRJS); do\
77           CURDIR=`pwd`;\
78           cd $$prj && $(MAKE) mostlyclean; cd $(CURDIR);\
79         done
80
81
82 # Deleting everything that can reconstructed by this Makefile. It deletes
83 # everything deleted by distclean plus files created by bison, stc.
84 # -----------------------------------------------------------------------
85 realclean: distclean
86         $(MAKE) -f clean.mk realclean
87         @for pkg in $(PKGS); do\
88           CURDIR=`pwd`;\
89           cd $$pkg && $(MAKE) -f clean.mk realclean; cd $(CURDIR);\
90         done
91         @for prj in $(PRJS); do\
92           CURDIR=`pwd`;\
93           cd $$prj && $(MAKE) realclean; cd $(CURDIR);\
94         done
95
96
97 # Creating distribution
98 # ---------------------
99 dist: distclean
100         @if [ -f devel ]; then\
101           rm -f devel; mkdist sdcc; touch devel;\
102         else\
103           mkdist sdcc;\
104         fi
105
106
107 # Performing self-test
108 # --------------------
109 check:
110
111
112 # Performing installation test
113 # ----------------------------
114 installcheck:
115
116
117 # Creating dependencies
118 # ---------------------
119 dep:
120         $(MAKE) -f main.mk dep
121         @for pkg in $(PKGS); do\
122           CURDIR=`pwd`;\
123           cd $$pkg && $(MAKE) dep; cd $(CURDIR);\
124         done
125
126
127 # My rules
128 # --------
129
130 putcopyright:
131         'put(c)' -s $(STARTYEAR) *.cc *.h *.y *.l
132
133
134 # Remaking configuration
135 # ----------------------
136 configure: configure.in
137         $(SHELL) $(AUTOCONF)
138
139 main.mk: $(srcdir)/main_in.mk $(srcdir)/configure.in config.status
140         $(SHELL) ./config.status
141
142 Makefiles: makefiles
143
144 makefiles: config.status
145
146 config.status: configure
147         $(SHELL) ./config.status --recheck
148
149 makefiles:
150         $(SHELL) ./config.status
151
152 freshconf: main.mk
153
154 checkconf:
155         @if [ -f devel ]; then\
156           $(MAKE) freshconf;\
157         fi
158
159 # End of Makefile