Can now make install.

This commit is contained in:
Anthony Arnold 2012-01-17 17:10:23 +10:00
parent 2896506335
commit 5d28bc1365
11 changed files with 146 additions and 50 deletions

6
.gitignore vendored
View File

@ -1,6 +1,2 @@
*.o
*.ali
*.a
*.so
*.so.*
*~
*.gpr

86
Makefile Normal file
View File

@ -0,0 +1,86 @@
LIB=./lib/libadaid.so
DEBUG=./lib/libadaid.a
TEST=./bin/test
GNAT=gnat
RM=rm
CHMOD=chmod
MKDIR=mkdir -p
CP=cp
.PHONY: debug test install installclean clean cleanall all support remove
#library
$(LIB): src/*.adb src/*.ads include/*.ads
$(GNAT) make -Padaid.gpr
#installation
INSTALL = $(shell which $(GNAT) 2> /dev/null | sed -e 's/\/bin\/gnat.*//')
INCLUDE= $(INSTALL)/share/ada/adainclude/adaid
LIBRARY=$(INSTALL)/lib
ALI=$(INSTALL)/lib/ada/adalib/adaid
GPR = $(INSTALL)/share/ada/adainclude
support/adaid.gpr: support/adaid.gpr.in
@cat $< | sed -e 's!%LIB_DIR%!$(LIBRARY)!' \
-e 's!%SRC_DIR%!$(INCLUDE)!' \
-e 's!%ALI_DIR%!$(ALI)!' > $@
installclean:
ifeq ($(INSTALL),)
@echo 'Error when installing: $$INSTALL is empty...'
@echo "Please set an installation path before installing"
else
-$(CHMOD) -f -R 777 $(ALI)
$(RM) -fr $(ALI)
-$(CHMOD) -f -R 777 $(INCLUDE)
$(RM) -fr $(INCLUDE)
$(RM) -f $(GPR)/adaid.gpr
$(RM) -f $(GPR)/adaid_debug.gpr
endif
install: installclean support/adaid.gpr
ifneq ($(INSTALL),)
$(MKDIR) $(GPR)
$(MKDIR) $(LIBRARY)
$(MKDIR) $(INCLUDE)
$(MKDIR) $(ALI)
$(CP) -r ali/* $(ALI)
$(CP) support/*.gpr $(GPR)
$(CP) -r lib/* $(LIBRARY)
$(CP) -r include/* $(INCLUDE)
@echo '-- AdaID has been installed.'
endif
remove: installclean
#debug library
debug: support/adaid_debug.gpr $(DEBUG)
support/adaid_debug.gpr: support/adaid_debug.gpr.in
@cat $< n | sed -e 's!%LIB_DIR%!$(LIBRARY)!' \
-e 's!%SRC_DIR%!$(INCLUDE)!' \
-e 's!%ALI_DIR%!$(ALI)!' > $@
$(DEBUG): src/*.adb src/*.ads include/*.ads
$(GNAT) make -Padaid_debug.gpr
#test executable
$(TEST): $(LIB) include/*.ads test/*.adb test/*.ads
$(GNAT) make -Ptest.gpr
#run tests
test: $(TEST)
$(TEST)
#misc
all: $(LIB) $(TEST)
clean:
$(RM) -f support/*.gpr obj/*.* obj/test/*.* obj/debug/*.* ali/*.* ali/debug/*.* 2> /dev/null
cleanall: clean
$(RM) -f bin/* lib/* 2> /dev/null

View File

@ -1,5 +1,5 @@
library project AdaID is
Version := "1";
Version := "0.0.0";
for Library_Name use "adaid";
for Object_Dir use "obj";
for Source_Dirs use ("src");
@ -9,10 +9,19 @@ library project AdaID is
for Library_Version use "libadaid.so." & Version;
package Builder is
for Default_Switches("Ada") use ("-O2", "-gnat12", "-gnatQ");
for Default_Switches("Ada") use ("-O2",
"-Wall",
"-Wextra",
"-gnat12",
"-gnatQ");
end Builder;
package Compiler is
for Default_Switches("Ada") use ("-O2", "-gnat12", "-I./include");
for Default_Switches("Ada") use ("-O2",
"-Wall",
"--pedantic-errors",
"-Wextra",
"-gnat12",
"-I./include");
end Compiler;
end AdaID;

View File

@ -7,10 +7,19 @@ library project AdaID_Debug is
for Library_ALI_Dir use "ali/debug";
package Builder is
for Default_Switches("Ada") use ("-g", "-gnat12", "-gnatQ");
for Default_Switches("Ada") use ("-g",
"-Wall",
"-Wextra",
"-gnat12",
"-gnatQ");
end Builder;
package Compiler is
for Default_Switches("Ada") use ("-g", "-gnat12", "-I./include");
for Default_Switches("Ada") use ("-g",
"-Wall",
"--pedantic-errors",
"-Wextra",
"-gnat12",
"-I./include");
end Compiler;
end AdaID_Debug;

View File

@ -1,36 +0,0 @@
LIB=./lib/libadaid.so
DEBUG=./lib/libadaid.a
TEST=./bin/test
#library
$(LIB): src/*.adb src/*.ads include/*.ads
gnatmake -Padaid.gpr
#debugging
.PHONY: debug
debug: $(DEBUG)
$(DEBUG): src/*.adb src/*.ads include/*.ads
gnatmake -Padaid_debug.gpr
#test executable
$(TEST): $(LIB) include/*.ads test/*.adb test/*.ads
gnatmake -Ptest.gpr
#run tests
test: $(TEST)
$(TEST)
#misc
.PHONY: all
all: $(LIB) $(TEST)
.PHONY: clean
.PHONY: cleanall
clean:
rm -f obj/*.* obj/test/*.* obj/debug/*.* ali/*.* ali/debug/*.* 2> /dev/null
cleanall: clean
rm -f bin/* lib/* 2> /dev/null

View File

@ -37,7 +37,7 @@ package body AdaID.Generate is
rand := RNG.Random(generator);
for i in ByteArray'Range loop
if x = Unsigned_32'Size then
if x = 4 then
x := 0;
rand := RNG.Random(generator);
end if;

0
support/.gitignore vendored Normal file
View File

8
support/adaid.gpr.in Normal file
View File

@ -0,0 +1,8 @@
project AdaID is
for Library_Dir use "%LIB_DIR%";
for Library_ALI_Dir use "%ALI_DIR%";
for Library_Name use "adaid";
for Library_Kind use "dynamic";
for Externally_Built use "true";
for Source_Dirs use ("%SRC_DIR%");
end AdaID;

View File

@ -0,0 +1,11 @@
project AdaID_Debug is
for Library_Dir use "../../../lib";
for Library_ALI_Dir use "../../../lib/ada/adalib/adaid/debug";
for Library_Name use "adaid_debug";
for Library_Kind use "static";
for Externally_Built use "true";
for Source_Dirs use ("./adaid");
end AdaID_Debug;

View File

@ -8,7 +8,12 @@ project Test is
for Exec_Dir use "bin";
package Builder is
for Default_Switches("Ada") use ("-g", "-gnat12", "-gnatQ", "-I./include");
for Default_Switches("Ada") use ("-g",
"-Wall",
"-Wextra",
"-gnat12",
"-gnatQ",
"-I./include");
end Builder;
@ -17,7 +22,15 @@ project Test is
end Linker;
package Compiler is
for Default_Switches("Ada") use ("-Llib", "-ladaid_debug", "-gnatf", "-g", "-I./include");
for Default_Switches("Ada") use ("-Llib",
"-ladaid_debug",
"-gnatf",
"-gnatwaeF",
"-g",
"-Wall",
"--pedantic-errors",
"-Wextra",
"-I./include");
end Compiler;
package Binder is

View File

@ -10,7 +10,7 @@ with AdaID_Tests;
procedure Test is
function Suite return Access_Test_Suite is
Result : Access_Test_Suite := new Test_Suite;
Result : constant Access_Test_Suite := new Test_Suite;
begin
Add_Test(Result, new AdaID_Tests.UUID_Test);
return Result;