@@ -48,10 +48,6 @@ ifndef CAMLNATTL
4848 endif
4949endif
5050
51- ifndef ARCHOS
52- ARCHOS =@ARCHOS@
53- endif
54-
5551ifndef MINGW
5652 MINGW =@MINGW@
5753endif
7369endif
7470
7571# Put here all the byproducts of make
76- OBJDIR := obj/ $( ARCHOS )
72+ OBJDIR := obj
7773DEPENDDIR := obj/.depend
7874
7975CILLY_FEATURES :=
@@ -134,15 +130,20 @@ ocamlbuild:
134130
135131 # Now the rule to make cilly
136132
137- cilly : $(OBJDIR ) /cilly$(EXE )
133+ cilly/Makefile : cilly/Makefile.PL cilly/App/Cilly.pm
134+ cd cilly; perl Makefile.PL
135+
136+ cilly : $(OBJDIR ) /cilly$(EXE ) cilly/Makefile
137+ $(MAKE ) -C cilly
138+
138139$(OBJDIR ) /cilly$(EXE ) : $(CILLY_MODULES:%=$(OBJDIR ) /%.$(CMO ) )
139140 @$(NARRATIVE ) " Linking $( COMPILETOWHAT) $@ $( LINKMSG) "
140141 $(AT )$(CAMLLINK ) -verbose -o $@ \
141142 $(CILLY_LIBS:% =%.$(CMXA ) ) \
142143 $^
143144
144145
145- quickbuild : cilversion machdep cilly lib /Cilly.pm
146+ quickbuild : cilversion machdep cilly cilly/App /Cilly.pm
146147
147148# Setup also makes the native code versions
148149
@@ -218,15 +219,17 @@ $(OBJDIR)/machdep.ml : src/machdep-ml.c configure.in Makefile.in
218219 echo "let theMachine : mach ref = ref gcc" >>$@
219220
220221
221- lib/Cilly.pm : lib/Cilly.pm.in src/machdep-ml.c configure.in Makefile.in
222- cp lib/Cilly.pm.in lib/Cilly.pm
222+ cilly/App/Cilly.pm : cilly/App/Cilly.pm.in src/machdep-ml.c configure.in Makefile.in
223+ cp cilly/App/Cilly.pm.in cilly/App/Cilly.pm
224+ sed -e " s|CIL_VERSION|@CIL_VERSION@|" cilly/App/Cilly.pm > cilly/App/Cilly.pm.tmp; \
225+ mv cilly/App/Cilly.pm.tmp cilly/App/Cilly.pm; \
223226 if $( MACHDEPCC) -m32 src/machdep-ml.c -o $( OBJDIR) /machdep-ml32.exe ; then \
224- sed -e " s|nogcc32model|` $( EMUL) $( OBJDIR) /machdep-ml32.exe --env` |" lib/ Cilly.pm > lib /Cilly.pm.tmp; \
225- mv lib/ Cilly.pm.tmp lib /Cilly.pm; \
227+ sed -e " s|nogcc32model|` $( EMUL) $( OBJDIR) /machdep-ml32.exe --env` |" cilly/App/ Cilly.pm > cilly/App /Cilly.pm.tmp; \
228+ mv cilly/App/ Cilly.pm.tmp cilly/App /Cilly.pm; \
226229 fi
227230 if $( MACHDEPCC) -m64 src/machdep-ml.c -o $( OBJDIR) /machdep-ml64.exe ; then \
228- sed -e " s|nogcc64model|` $( EMUL) $( OBJDIR) /machdep-ml64.exe --env` |" lib/ Cilly.pm > lib /Cilly.pm.tmp; \
229- mv lib/ Cilly.pm.tmp lib /Cilly.pm; \
231+ sed -e " s|nogcc64model|` $( EMUL) $( OBJDIR) /machdep-ml64.exe --env` |" cilly/App/ Cilly.pm > cilly/App /Cilly.pm.tmp; \
232+ mv cilly/App/ Cilly.pm.tmp cilly/App /Cilly.pm; \
230233 fi
231234
232235# Create the version information module
@@ -238,7 +241,7 @@ $(OBJDIR)/cilversion.ml: src/cilversion.ml.in config.status
238241
239242# build library
240243.PHONY : cillib
241- cillib : $(OBJDIR ) /cil.$(CMXA ) lib /Cilly.pm
244+ cillib : $(OBJDIR ) /cil.$(CMXA ) cilly/App /Cilly.pm
242245
243246$(OBJDIR ) /feature_config.ml : config.status
244247 rm -f $(OBJDIR ) /feature_config.*
@@ -315,7 +318,7 @@ odoc: $(OBJDIR)/pretty.cmi $(OBJDIR)/cil.cmi
315318 -t "CIL API Documentation (version @CIL_VERSION@)" \
316319 -I $(OBJDIR) -hide Pervasives $(ODOC_FILES)
317320
318- doc/cilpp.tex : doc/cilcode.pl doc/cil.tex lib /Cilly.pm
321+ doc/cilpp.tex : doc/cilcode.pl doc/cil.tex cilly/App /Cilly.pm
319322 -rm -rf doc/html/cil
320323 -mkdir -p doc/html/cil
321324 -mkdir -p doc/html/cil/examples
@@ -357,9 +360,8 @@ doc: texdoc pdfdoc odoc
357360distclean : clean
358361 rm -f src/frontc/cparser.output
359362 rm -f src/formatparse.output
360- rm -f bin/cilly.bat
361- rm -f bin/patcher.bat
362- rm -f bin/CilConfig.pm
363+ rm -f cilly/App/CilConfig.pm
364+ rm -f cilly/Makefile.old
363365 rm -f config.log
364366 rm -f config.h
365367 rm -f Makefile
@@ -370,7 +372,8 @@ cleancheck:
370372 rm -f test/small1/vararg1
371373 rm -f test/small1/wchar1
372374
373- clean : cleancaml cleancheck
375+ clean : cleancaml cleancheck cilly/Makefile
376+ $(MAKE ) -C cilly clean
374377
375378
376379# Now include the compiler specific stuff
@@ -383,13 +386,15 @@ else
383386endif
384387
385388test/% :
386- bin /cilly $(CONLY ) test/small1/$* .c $(OBJOUT ) test/small1/$* .o
389+ cilly /cilly $(CONLY ) test/small1/$* .c $(OBJOUT ) test/small1/$* .o
387390
388391testrun/% :
389- bin /cilly test/small1/$* .c $(OBJOUT ) test/small1/$*
392+ cilly /cilly test/small1/$* .c $(OBJOUT ) test/small1/$*
390393 test/small1/$*
391394
392-
395+ .PHONY : regtest
396+ regtest :
397+ cd test ; ./testcil -r --regrtest
393398
394399.PHONY : quicktest
395400quicktest : $(patsubst % ,test/% ,func init init1) \
@@ -400,7 +405,6 @@ check: quicktest
400405
401406# #######################################################################
402407
403-
404408INSTALL = @INSTALL@
405409INSTALL_DATA = @INSTALL_DATA@
406410
@@ -412,31 +416,23 @@ pkglibdir = $(libdir)/cil
412416libexecdir = @libexecdir@
413417pkglibexecdir = $(libexecdir ) /cil
414418bindir = @bindir@
415- # Hack - I don't know how to find perl_vendorlib
416- perl_vendorlib = $(libdir )
417-
418- install : install-findlib
419- $(INSTALL ) -d $(DESTDIR )$(perl_vendorlib )
420- $(INSTALL ) -m 0644 lib/* .pm bin/CilConfig.pm $(DESTDIR )$(perl_vendorlib )
421- sed -e " s,^.*cilhome.*$$ ,\$ $::cilhome = \" $( libexecdir) /cil\" ;," $(DESTDIR )$(perl_vendorlib ) /CilConfig.pm > $(DESTDIR )$(perl_vendorlib ) /CilConfig.pm.tmp
422- mv $(DESTDIR )$(perl_vendorlib ) /CilConfig.pm.tmp $(DESTDIR )$(perl_vendorlib ) /CilConfig.pm
423- $(INSTALL ) -d $(DESTDIR )$(bindir )
424- $(INSTALL ) -m 0755 bin/cilly $(DESTDIR )$(bindir )
425- $(INSTALL ) -d $(DESTDIR )$(pkglibexecdir ) /$(OBJDIR )
426- $(INSTALL ) -m 0755 $(OBJDIR ) /cilly.* .exe $(DESTDIR )$(pkglibexecdir ) /$(OBJDIR )
419+
420+ install : install-findlib cilly/Makefile
421+ $(MAKE ) -C cilly install CILBINDIR=" $( libexecdir) /cil"
422+ $(INSTALL ) -d $(DESTDIR )$(pkglibexecdir )
423+ $(INSTALL ) -m 0755 $(OBJDIR ) /cilly.* .exe $(DESTDIR )$(pkglibexecdir )
427424
428425# FIXME
429- uninstall : uninstall-findlib
426+ uninstall : uninstall-findlib cilly/Makefile
430427 -rm -rf $(DESTDIR )$(pkglibexecdir )
431- -rm -f $(DESTDIR )$(bindir ) /cilly
432- -rm -f $(DESTDIR )$(perl_vendorlib ) /CilConfig.pm $(DESTDIR )$(perl_vendorlib ) /Cilly.pm \
433- $(DESTDIR )$(perl_vendorlib ) /KeptFile.pm $(DESTDIR )$(perl_vendorlib ) /OutputFile.pm \
434- $(DESTDIR )$(perl_vendorlib ) /TempFile.pm
428+ $(MAKE ) -C cilly uninstall
429+
430+ .PHONY : install-findlib uninstall-findlib
435431
436432EVERYTHING =$(OBJDIR ) /*.cmi $(OBJDIR ) /*.cmx $(OBJDIR ) /*.cma $(OBJDIR ) /*.mli \
437433 $(OBJDIR ) /*.cmxa $(OBJDIR ) /*.a $(SOURCEDIRS:%=%/*.mli )
438434
439- install-findlib : all $(EVERYTHING )
435+ install-findlib : all $(EVERYTHING ) uninstall-findlib
440436 ocamlfind install cil META $(EVERYTHING )
441437
442438uninstall-findlib :
0 commit comments