1 # Makefile for linux/bsd/unix and tcc. Commands executed by: bash 2 # To compile use a command shell and call: 3 # make -f mk_tcc_l.mak depend 4 # make -f mk_tcc_l.mak 5 # If you are using tcc under windows you should use mk_tcc_w.mak instead. 6 7 # CFLAGS = 8 # CFLAGS = -Wall -Wstrict-prototypes -Winline -Wconversion -Wshadow -Wpointer-arith 9 # CFLAGS = -O2 -fomit-frame-pointer -Wall -Wstrict-prototypes -Winline -Wconversion -Wshadow -Wpointer-arith 10 # CFLAGS = -O2 -g -Wall -Wextra -Wswitch-default -Wswitch-enum -Wcast-qual -Waggregate-return -Wwrite-strings -Wstrict-prototypes -Winline -Wconversion -Wshadow -Wpointer-arith -Wmissing-noreturn -Wno-multichar -Wc++-compat 11 # CFLAGS = -O2 -g -x c++ -Wall -Wextra -Wswitch-default -Wswitch-enum -Wcast-qual -Waggregate-return -Wwrite-strings -Winline -Wconversion -Wshadow -Wpointer-arith -Wmissing-noreturn -Wno-multichar 12 # CFLAGS = -O2 -fomit-frame-pointer -Wall -Wextra -Wswitch-default -Wcast-qual -Waggregate-return -Wwrite-strings -Winline -Wconversion -Wshadow -Wpointer-arith -Wmissing-noreturn -Wno-multichar 13 # CFLAGS = -O2 -g -Wall -Wstrict-prototypes -Winline -Wconversion -Wshadow -Wpointer-arith -ftrapv 14 # CFLAGS = -O2 -g -x c++ -Wall -Winline -Wconversion -Wshadow -Wpointer-arith 15 CFLAGS = -g $(INCLUDE_OPTIONS) -Wall -Wimplicit-function-declaration -Wunusupported -Wwrite-strings 16 # CFLAGS = -O2 -g -Wall -Winline -Wconversion -Wshadow -Wpointer-arith 17 # CFLAGS = -O2 -g -Wall 18 # CFLAGS = -O2 -g -pg -Wall -Wstrict-prototypes -Winline -Wconversion -Wshadow -Wpointer-arith 19 # CFLAGS = -O2 -fomit-frame-pointer -funroll-loops -Wall 20 # CFLAGS = -O2 -funroll-loops -Wall -pg 21 LDFLAGS = 22 # LDFLAGS = -pg 23 # LDFLAGS = -pg -lc_p 24 SYSTEM_LIBS = -lm 25 # SYSTEM_LIBS = -lm -lgmp 26 # SYSTEM_LIBS = -lm_p -lc_p 27 # SYSTEM_DRAW_LIBS is defined in the file "macros". The program chkccomp.c writes it to "macros" when doing "make depend". 28 # SYSTEM_CONSOLE_LIBS is defined in the file "macros". The program chkccomp.c writes it to "macros" when doing "make depend". 29 # SYSTEM_DATABASE_LIBS is defined in the file "macros". The program chkccomp.c writes it to "macros" when doing "make depend". 30 SEED7_LIB = seed7_05.a 31 DRAW_LIB = s7_draw.a 32 CONSOLE_LIB = s7_con.a 33 DATABASE_LIB = s7_db.a 34 COMP_DATA_LIB = s7_data.a 35 COMPILER_LIB = s7_comp.a 36 ALL_S7_LIBS = ../bin/$(COMPILER_LIB) ../bin/$(COMP_DATA_LIB) ../bin/$(DRAW_LIB) ../bin/$(CONSOLE_LIB) ../bin/$(DATABASE_LIB) ../bin/$(SEED7_LIB) 37 CC = tcc 38 AR = ar 39 40 MOBJ = s7.o 41 POBJ = runerr.o option.o primitiv.o 42 LOBJ = actlib.o arrlib.o biglib.o binlib.o blnlib.o bstlib.o chrlib.o cmdlib.o conlib.o dcllib.o \ 43 drwlib.o enulib.o fillib.o fltlib.o hshlib.o intlib.o itflib.o kbdlib.o lstlib.o pcslib.o \ 44 pollib.o prclib.o prglib.o reflib.o rfllib.o sctlib.o setlib.o soclib.o sqllib.o strlib.o \ 45 timlib.o typlib.o ut8lib.o 46 EOBJ = exec.o doany.o objutl.o 47 AOBJ = act_comp.o prg_comp.o analyze.o syntax.o token.o parser.o name.o type.o \ 48 expr.o atom.o object.o scanner.o literal.o numlit.o findid.o \ 49 error.o infile.o libpath.o symbol.o info.o stat.o fatal.o match.o 50 GOBJ = syvarutl.o traceutl.o actutl.o executl.o blockutl.o \ 51 entutl.o identutl.o chclsutl.o arrutl.o 52 ROBJ = arr_rtl.o bln_rtl.o bst_rtl.o chr_rtl.o cmd_rtl.o con_rtl.o dir_rtl.o drw_rtl.o fil_rtl.o \ 53 flt_rtl.o hsh_rtl.o int_rtl.o itf_rtl.o pcs_rtl.o set_rtl.o soc_rtl.o sql_rtl.o str_rtl.o \ 54 tim_rtl.o ut8_rtl.o heaputl.o numutl.o sigutl.o striutl.o 55 DOBJ = big_rtl.o big_gmp.o cmd_unx.o dir_win.o dll_unx.o fil_unx.o pcs_unx.o pol_unx.o soc_none.o \ 56 tim_unx.o 57 OBJ = $(MOBJ) 58 SEED7_LIB_OBJ = $(ROBJ) $(DOBJ) 59 DRAW_LIB_OBJ = gkb_rtl.o drw_x11.o gkb_x11.o fwd_x11.o 60 CONSOLE_LIB_OBJ = kbd_rtl.o con_inf.o kbd_inf.o kbd_poll.o trm_inf.o trm_cap.o fwd_term.o 61 DATABASE_LIB_OBJ = sql_base.o sql_db2.o sql_fire.o sql_lite.o sql_my.o sql_oci.o sql_odbc.o \ 62 sql_post.o sql_srv.o sql_tds.o 63 COMP_DATA_LIB_OBJ = typ_data.o rfl_data.o ref_data.o listutl.o flistutl.o typeutl.o datautl.o 64 COMPILER_LIB_OBJ = $(POBJ) $(LOBJ) $(EOBJ) $(AOBJ) $(GOBJ) 65 66 MSRC = s7.c 67 PSRC = runerr.c option.c primitiv.c 68 LSRC = actlib.c arrlib.c biglib.c binlib.c blnlib.c bstlib.c chrlib.c cmdlib.c conlib.c dcllib.c \ 69 drwlib.c enulib.c fillib.c fltlib.c hshlib.c intlib.c itflib.c kbdlib.c lstlib.c pcslib.c \ 70 pollib.c prclib.c prglib.c reflib.c rfllib.c sctlib.c setlib.c soclib.c sqllib.c strlib.c \ 71 timlib.c typlib.c ut8lib.c 72 ESRC = exec.c doany.c objutl.c 73 ASRC = act_comp.c prg_comp.c analyze.c syntax.c token.c parser.c name.c type.c \ 74 expr.c atom.c object.c scanner.c literal.c numlit.c findid.c \ 75 error.c infile.c libpath.c symbol.c info.c stat.c fatal.c match.c 76 GSRC = syvarutl.c traceutl.c actutl.c executl.c blockutl.c \ 77 entutl.c identutl.c chclsutl.c arrutl.c 78 RSRC = arr_rtl.c bln_rtl.c bst_rtl.c chr_rtl.c cmd_rtl.c con_rtl.c dir_rtl.c drw_rtl.c fil_rtl.c \ 79 flt_rtl.c hsh_rtl.c int_rtl.c itf_rtl.c pcs_rtl.c set_rtl.c soc_rtl.c sql_rtl.c str_rtl.c \ 80 tim_rtl.c ut8_rtl.c heaputl.c numutl.c sigutl.c striutl.c 81 DSRC = big_rtl.c big_gmp.c cmd_unx.c dir_win.c dll_unx.c fil_unx.c pcs_unx.c pol_unx.c soc_none.c \ 82 tim_unx.c 83 SRC = $(MSRC) 84 SEED7_LIB_SRC = $(RSRC) $(DSRC) 85 DRAW_LIB_SRC = gkb_rtl.c drw_x11.c gkb_x11.c fwd_x11.c 86 CONSOLE_LIB_SRC = kbd_rtl.c con_inf.c kbd_inf.c kbd_poll.c trm_inf.c trm_cap.c fwd_term.c 87 DATABASE_LIB_SRC = sql_base.c sql_db2.c sql_fire.c sql_lite.c sql_my.c sql_oci.c sql_odbc.c \ 88 sql_post.c sql_srv.c sql_tds.c 89 COMP_DATA_LIB_SRC = typ_data.c rfl_data.c ref_data.c listutl.c flistutl.c typeutl.c datautl.c 90 COMPILER_LIB_SRC = $(PSRC) $(LSRC) $(ESRC) $(ASRC) $(GSRC) 91 92 s7: ../bin/s7 ../prg/s7 93 ../bin/s7 -l ../lib level 94 @echo 95 @echo " Use 'make s7c' (with your make command) to create the compiler." 96 @echo 97 98 s7c: ../bin/s7c ../prg/s7c 99 @echo 100 @echo " Use 'make test' (with your make command) to check Seed7." 101 @echo 102 103 ../bin/s7: levelup next_lvl $(OBJ) $(ALL_S7_LIBS) 104 $(CC) $(LDFLAGS) $(OBJ) $(ALL_S7_LIBS) $(SYSTEM_DRAW_LIBS) $(SYSTEM_CONSOLE_LIBS) $(SYSTEM_DATABASE_LIBS) $(SYSTEM_LIBS) $(ADDITIONAL_SYSTEM_LIBS) -o ../bin/s7 105 rm next_lvl 106 107 ../prg/s7: 108 ln -s ../bin/s7 ../prg 109 110 ../bin/s7c: ../prg/s7c 111 cp -p ../prg/s7c ../bin 112 113 ../prg/s7c: ../prg/s7c.sd7 $(ALL_S7_LIBS) 114 ../bin/s7 -l ../lib ../prg/s7c -l ../lib -b ../bin -O2 ../prg/s7c 115 116 levelup: levelup.c 117 $(CC) levelup.c -o levelup 118 119 next_lvl: levelup 120 ./levelup 121 echo "X" > next_lvl 122 123 sql_db2.o: sql_db2.c 124 $(CC) $(CPPFLAGS) $(DB2_INCLUDE_OPTION) $(CFLAGS) -c $< 125 126 sql_srv.o: sql_srv.c 127 $(CC) $(CPPFLAGS) $(SQL_SERVER_INCLUDE_OPTION) $(CFLAGS) -c $< 128 129 all: depend 130 $(MAKE) -f mk_tcc_l.mak s7 s7c 131 132 clear: clean 133 134 clean: 135 rm -f *.o ../bin/*.a ../bin/s7 ../bin/s7c ../prg/s7 ../prg/s7c depend macros chkccomp.h base.h settings.h version.h wrdepend levelup next_lvl 136 @echo 137 @echo " Use 'make depend' (with your make command) to create the dependencies." 138 @echo 139 140 distclean: clean 141 cp level_bk.h level.h 142 rm -f vers_tcc_l.h 143 144 test: 145 ../bin/s7 -l ../lib ../prg/chk_all build 146 @echo 147 @echo " Use 'sudo make install' (with your make command) to install Seed7." 148 @echo 149 150 install: 151 cd ../bin; ln -s `pwd`/s7 /usr/local/bin 152 cd ../bin; ln -s `pwd`/s7c /usr/local/bin 153 gzip -c ../doc/s7.1 > /usr/share/man/man1/s7.1.gz 154 gzip -c ../doc/s7c.1 > /usr/share/man/man1/s7c.1.gz 155 156 uninstall: 157 rm /usr/local/bin/s7 158 rm /usr/local/bin/s7c 159 rm /usr/share/man/man1/s7.1.gz 160 rm /usr/share/man/man1/s7c.1.gz 161 162 dep: depend 163 164 strip: 165 strip ../bin/s7 166 167 chkccomp.h: 168 echo "#define LIST_DIRECTORY_CONTENTS \"ls\"" > chkccomp.h 169 170 base.h: 171 echo "#define PATH_DELIMITER '/'" > base.h 172 echo "#define OBJECT_FILE_EXTENSION \".o\"" >> base.h 173 echo "#define C_COMPILER \"$(CC)\"" >> base.h 174 echo "#define CC_OPT_VERSION_INFO \"-v\"" >> base.h 175 echo "#define CC_FLAGS \"\"" >> base.h 176 echo "#define CC_ERROR_FILEDES 2" >> base.h 177 echo "#define CC_VERSION_INFO_FILEDES 1" >> base.h 178 echo "#define LINKER_OPT_OUTPUT_FILE \"-o \"" >> base.h 179 echo "#define SYSTEM_LIBS \"$(SYSTEM_LIBS)\"" >> base.h 180 181 settings.h: 182 echo "#define MAKE_UTILITY_NAME \"$(MAKE)\"" > settings.h 183 echo "#define MAKEFILE_NAME \"mk_tcc_l.mak\"" >> settings.h 184 echo "#define SEARCH_PATH_DELIMITER ':'" >> settings.h 185 echo "#define AWAIT_WITH_SELECT" >> settings.h 186 echo "#define DEFINE_DSO_HANDLE" >> settings.h 187 echo "#define SIGNAL_HANDLER_CAN_DO_IO" >> settings.h 188 echo "#define CONSOLE_UTF8" >> settings.h 189 echo "#define OS_STRI_UTF8" >> settings.h 190 echo "#define ESCAPE_SHELL_COMMANDS" >> settings.h 191 echo "#define LIBRARY_FILE_EXTENSION \".a\"" >> settings.h 192 echo "#define CC_SOURCE_UTF8" >> settings.h 193 echo "#define CC_OPT_DEBUG_INFO \"-g\"" >> settings.h 194 echo "#define CC_OPT_NO_WARNINGS \"-w\"" >> settings.h 195 echo "#define LINKER_FLAGS \"$(LDFLAGS)\"" >> settings.h 196 echo "#define SEED7_LIB \"$(SEED7_LIB)\"" >> settings.h 197 echo "#define DRAW_LIB \"$(DRAW_LIB)\"" >> settings.h 198 echo "#define CONSOLE_LIB \"$(CONSOLE_LIB)\"" >> settings.h 199 echo "#define DATABASE_LIB \"$(DATABASE_LIB)\"" >> settings.h 200 echo "#define COMP_DATA_LIB \"$(COMP_DATA_LIB)\"" >> settings.h 201 echo "#define COMPILER_LIB \"$(COMPILER_LIB)\"" >> settings.h 202 203 version.h: chkccomp.h base.h settings.h 204 $(CC) chkccomp.c -o chkccomp 205 ./chkccomp version.h 206 rm chkccomp 207 $(CC) setpaths.c -o setpaths 208 ./setpaths "S7_LIB_DIR=$(S7_LIB_DIR)" "SEED7_LIBRARY=$(SEED7_LIBRARY)" >> version.h 209 rm setpaths 210 cp version.h vers_tcc_l.h 211 212 depend: version.h 213 @echo "Working without C header dependency checks." 214 @echo 215 @echo " Use 'make' (with your make command) to create the interpreter." 216 @echo 217 218 ../bin/$(SEED7_LIB): $(SEED7_LIB_OBJ) 219 $(AR) r ../bin/$(SEED7_LIB) $(SEED7_LIB_OBJ) 220 221 ../bin/$(DRAW_LIB): $(DRAW_LIB_OBJ) 222 $(AR) r ../bin/$(DRAW_LIB) $(DRAW_LIB_OBJ) 223 224 ../bin/$(CONSOLE_LIB): $(CONSOLE_LIB_OBJ) 225 $(AR) r ../bin/$(CONSOLE_LIB) $(CONSOLE_LIB_OBJ) 226 227 ../bin/$(DATABASE_LIB): $(DATABASE_LIB_OBJ) 228 $(AR) r ../bin/$(DATABASE_LIB) $(DATABASE_LIB_OBJ) 229 230 ../bin/$(COMP_DATA_LIB): $(COMP_DATA_LIB_OBJ) 231 $(AR) r ../bin/$(COMP_DATA_LIB) $(COMP_DATA_LIB_OBJ) 232 233 ../bin/$(COMPILER_LIB): $(COMPILER_LIB_OBJ) 234 $(AR) r ../bin/$(COMPILER_LIB) $(COMPILER_LIB_OBJ) 235 236 ../bin/%: ../prg/%.sd7 ../bin/s7c 237 ../bin/s7c -l ../lib -b ../bin -O2 $< 238 mv $(<:.sd7=) ../bin 239 240 bas7: ../bin/bas7 241 bigfiles: ../bin/bigfiles 242 calc7: ../bin/calc7 243 cat: ../bin/cat 244 comanche: ../bin/comanche 245 db7: ../bin/db7 246 diff7: ../bin/diff7 247 find7: ../bin/find7 248 findchar: ../bin/findchar 249 ftp7: ../bin/ftp7 250 ftpserv: ../bin/ftpserv 251 hd: ../bin/hd 252 make7: ../bin/make7 253 sql7: ../bin/sql7 254 sydir7: ../bin/sydir7 255 tar7: ../bin/tar7 256 toutf8: ../bin/toutf8 257 which: ../bin/which 258 259 utils: ../bin/bas7 ../bin/bigfiles ../bin/calc7 ../bin/cat ../bin/comanche ../bin/db7 \ 260 ../bin/diff7 ../bin/find7 ../bin/findchar ../bin/ftp7 ../bin/ftpserv ../bin/hd \ 261 ../bin/make7 ../bin/sql7 ../bin/sydir7 ../bin/tar7 ../bin/toutf8 ../bin/which 262 263 wc: $(SRC) 264 @echo SRC: 265 wc $(SRC) 266 @echo SEED7_LIB_SRC: 267 wc $(SEED7_LIB_SRC) 268 @echo DRAW_LIB_SRC: 269 wc $(DRAW_LIB_SRC) 270 @echo CONSOLE_LIB_SRC: 271 wc $(CONSOLE_LIB_SRC) 272 @echo DATABASE_LIB_SRC: 273 wc $(DATABASE_LIB_SRC) 274 @echo COMP_DATA_LIB_SRC: 275 wc $(COMP_DATA_LIB_SRC) 276 @echo COMPILER_LIB_SRC: 277 wc $(COMPILER_LIB_SRC) 278 279 lint: $(SRC) 280 lint -p $(SRC) $(SYSTEM_DRAW_LIBS) $(SYSTEM_CONSOLE_LIBS) $(SYSTEM_DATABASE_LIBS) $(SYSTEM_LIBS) $(ADDITIONAL_SYSTEM_LIBS) 281 282 lint2: $(SRC) 283 lint -Zn2048 $(SRC) $(SYSTEM_DRAW_LIBS) $(SYSTEM_CONSOLE_LIBS) $(SYSTEM_DATABASE_LIBS) $(SYSTEM_LIBS) $(ADDITIONAL_SYSTEM_LIBS) 284 285 cppcheck: $(SRC) $(SEED7_LIB_SRC) $(DRAW_LIB_SRC) $(COMP_DATA_LIB_SRC) $(COMPILER_LIB_SRC) 286 cppcheck --force --enable=all $(SRC) $(SEED7_LIB_SRC) $(DRAW_LIB_SRC) $(COMP_DATA_LIB_SRC) $(COMPILER_LIB_SRC) 287 288 ifeq (macros,$(wildcard macros)) 289 include macros 290 endif