# file: Makefile [$Revision: 1.21 $] # # This builds the "Florist" implementation of POSIX.5b, # and some test programs for it. # # If you need to modify the "configure" file, you will need # autoconf version 2.12, or maybe a later version will also work. # .POSIX: MASTERDIR=/part1/florist VERSION=Florist-3.15p (20020604) FLORIST_VERSION=$(VERSION) GNATMAKEFLAGS1 = -O2 GNATMAKEFLAGS1B = -O2 GNATMAKEFLAGS2 = -cargs -gnatpg -largs $(LIBS) GNATMAKEFLAGS2B = -cargs -gnatpg -largs $(LIBS) GCCFLAGS = -O2 GNATPREPFLAGS = -c -r # The following will be set based on # what the configure script discovers about the local system. CC = @CC@ LIBS = @LIBS@ DEPS = @DEPS@ ADDRINFO_OBJECTS = @ADDRINFO_OBJECTS@ SIGNALS_GENERATED = @SIGNALS_GENERATED@ DOCS = \ COPYING\ README\ RELEASE.NOTES\ NOTES.GENERAL\ NOTES.LINUX\ NOTES.ALPHA\ NOTES.HP\ NOTES.SOLARIS\ PASSFAIL\ PACKAGE.LIST TOOLS = \ Makefile\ MANIFEST\ aclocal.m4\ gnatprep.ads\ gnatprep.adb\ config.h.in\ configure\ configure.in # files generated by "configure" script CONFIG_GENERATED = \ config.h\ pconfig.h\ gnatprep.config\ pconfig.h.in CONFIG_HISTORY = \ config.cache\ config.log\ c-posix.log\ configure.log\ config.status\ stamp-h # files generated by "c-posix" program C-POSIX_GENERATED = \ posix.ads\ posix-limits.ads\ posix-options.ads\ posix-c.ads # files generated by "c-posix-signals" program C-POSIX-SIGNALS_GENERATED = $(SIGNALS_GENERATED) # files generated by "gnatprep" program GNATPREP_BODIES = \ posix-implementation.adb\ posix-process_identification.adb\ posix-process_primitives.adb\ posix-unsafe_process_primitives.adb\ posix-sockets.adb\ posix-sockets-internet.adb\ posix-xti.adb GNATPREP_SPECS = \ posix-implementation.ads\ posix-sockets.ads GNATPREP_GENERATED = $(GNATPREP_BODIES) $(GNATPREP_SPECS) GENERATED = $(CONFIG_GENERATED) $(C-POSIX_GENERATED) $(GNATPREP_GENERATED)\ $(C-POSIX-SIGNALS_GENERATED) # inputs to "gnatprep" GNATPREP_SOURCES = \ posix-implementation.gpb\ posix-implementation.gps\ posix-process_primitives.gpb\ posix-unsafe_process_primitives.gpb\ posix-sockets.gps\ posix-sockets.gpb\ posix-sockets-internet.gpb\ posix-xti.gpb # non-generated Ada and C source files for Florist FLORIST_SOURCES = $(GNATPREP_SOURCES)\ ada_streams.ads\ ada_task_identification.ads\ deps.ads\ deps.adb\ deps_no_thread.adb\ deps5c.ads\ deps5c.adb\ posix-asynchronous_io.adb\ posix-asynchronous_io.ads\ posix_asynchronous_io.ads\ posix-c.adb\ posix_c.ads\ posix-calendar.adb\ posix-calendar.ads\ posix_calendar.ads\ posix-condition_variables.adb\ posix-condition_variables.ads\ posix_condition_variables.ads\ posix-configurable_file_limits.adb\ posix-configurable_file_limits.ads\ posix_configurable_file_limits.ads\ posix-configurable_system_limits.adb\ posix-configurable_system_limits.ads\ posix_configurable_system_limits.ads\ posix-error_codes.ads\ posix_error_codes.ads\ posix-event_management.ads\ posix-event_management.adb\ posix-file_locking.adb\ posix-file_locking.ads\ posix_file_locking.ads\ posix-file_status.adb\ posix-file_status.ads\ posix_file_status.ads\ posix-files.adb\ posix-files.ads\ posix_files.ads\ posix-generic_shared_memory.adb\ posix-generic_shared_memory.ads\ posix_generic_shared_memory.ads\ posix-group_database.adb\ posix-group_database.ads\ posix_group_database.ads\ posix-io.adb\ posix-io.ads\ posix_io.ads\ posix_limits.ads\ posix-memory_locking.adb\ posix-memory_locking.ads\ posix_memory_locking.ads\ posix-memory_mapping.adb\ posix-memory_mapping.ads\ posix_memory_mapping.ads\ posix-memory_range_locking.adb\ posix-memory_range_locking.ads\ posix_memory_range_locking.ads\ posix-message_queues.adb\ posix-message_queues.ads\ posix_message_queues.ads\ posix-mutexes.adb\ posix-mutexes.ads\ posix_mutexes.ads\ posix_options.ads\ posix-page_alignment.adb\ posix-page_alignment.ads\ posix_page_alignment.ads\ posix-permissions-implementation.adb\ posix-permissions-implementation.ads\ posix-permissions.adb\ posix-permissions.ads\ posix_permissions.ads\ posix-process_environment.adb\ posix-process_environment.ads\ posix_process_environment.ads\ posix-process_identification.gpb\ posix-process_identification.ads\ posix_process_identification.ads\ posix-process_primitives.ads\ posix_process_primitives.ads\ posix-process_scheduling.adb\ posix-process_scheduling.ads\ posix_process_scheduling.ads\ posix-process_times.adb\ posix-process_times.ads\ posix_process_times.ads\ posix-semaphores.adb\ posix-semaphores.ads\ posix_semaphores.ads\ posix-shared_memory_objects.adb\ posix-shared_memory_objects.ads\ posix_shared_memory_objects.ads\ posix_signals.ads\ posix-sockets-internet.ads\ posix-sockets-iso.ads\ posix-sockets-local.ads\ posix-sockets-local.adb\ posix-supplement_to_ada_io.adb\ posix-supplement_to_ada_io.ads\ posix_supplement_to_ada_io.ads\ posix-terminal_functions.adb\ posix-terminal_functions.ads\ posix_terminal_functions.ads\ posix-timers.adb\ posix-timers.ads\ posix_timers.ads\ posix-unsafe_process_primitives.ads\ posix_unsafe_process_primitives.ads\ posix-user_database.adb\ posix-user_database.ads\ posix_user_database.ads\ posix-xti.ads\ posix-xti-internet.ads\ posix-xti-internet.adb\ posix-xti-iso.ads\ posix-xti-mosi.ads\ posix.adb\ system_storage_elements.ads\ c-posix.c\ c-posix-signals.c\ posix-macros.c\ posix-macros-xti.c\ posix-macros-sockets.c\ posix-macros-select.c\ c_inet_ntoa.c\ addrinfo.h\ getaddrinfo.c\ getnameinfo.c\ inet_ntop.c\ inet_pton.c DEBUG_SOURCES = \ l_close.c \ l_dup2.c \ l_execvp.c \ l_execvp1.c \ l_fcntl.c \ l_fifo.c \ l_fstat.c \ l_lseek.c \ l_read.c \ l_sigpending.c \ l_sigwait.c \ l_stat.c \ l_tcsetattr.c \ l_waitpid.c \ l_waitpid2.c \ s_cfsetispeed.c \ s_sigwaitinfo.c \ s_timer.c ALL_SOURCES = $(GENERATED) $(FLORIST_SOURCES) # all the executable programs EXECUTABLES =\ gnatprep\ c-posix\ deps\ deps_no_thread\ deps5c MACRO_OBJECTS =\ posix-macros.o\ posix-macros-xti.o\ posix-macros-sockets.o\ posix-macros-select.o\ c_inet_ntoa.o # default target, get the gnat version and the system type and then # set up files and call make again (in uname) all: floristlib florist: touch florist # # ------------------------------------ # configure-script # ------------------------------------ # # This first step should not need to be done during # normal installation # configure: configure.in aclocal.m4 autoconf # # ------------------------------------ # generation of OS dependent sources # ------------------------------------ # # Program c-posix generates some Ada package specs. # It is supposed to be a "portable" POSIX C program. # If it does not compile or does not link, # it might be fixable by hand-editing config.h or pconfig.h. # If you are unlucky, it will require fixes to c-posix.c. # c-posix: c-posix.c config.h pconfig.h $(CC) $(GCCFLAGS) -DVERSION="\"$(VERSION)\"" -DLIBS="\"$(LIBS)\"" -o c-posix c-posix.c $(LIBS) # # Program c-posix-signals generates another Ada package spec. # It is also supposed to be a "portable" POSIX C program. # c-posix-signals: c-posix-signals.c $(CC) $(GCCFLAGS) -ansi -o c-posix-signals \ c-posix-signals.c $(LIBS) # # generate Ada source files using "c-posix" program # $(C-POSIX_GENERATED): c-posix rm -f posix.ads posix-limits.ads posix-options.ads posix-c.ads\ tmpposix.ads # See file "c-posix.log" for results of this step. ./c-posix > c-posix.log 2>&1 rm -f tmpposix.ads # # generate Ada source files using "c-posix-signals" program # posix-implementation-ok_signals.ads: c-posix-signals rm -f posix-implementations-ok_signals.ads # See file "c-posix-signals.log" for results of this step. ./c-posix-signals -nodefaults > c-posix-signals.log 2>&1 # # Some other Ada source files are tailored to the # particular OS using the "gnatprep" program. # The sources for these end in ".gpb" and ".gps". # $(GNATPREP_BODIES): gnatprep.config $(GNATPREP_SPECS): gnatprep.config .SUFFIXES: .gps .gpb .ads .adb .o .c .gps.ads: gnatprep $< $@ gnatprep.config $(GNATPREPFLAGS) .gpb.adb: gnatprep $< $@ gnatprep.config $(GNATPREPFLAGS) .c.o: $(CC) -c $(GCCFLAGS) $< # # # Some POSIX interfaces use macros. # To make these usable from Ada, we have C subprograms. # $(MACRO_OBJECTS): pconfig.h # # Some POSIX interfaces use macros. # To make these usable from Ada, we have C subprograms. # $(ADDRINFO_OBJECTS): pconfig.h # # ------------------------------------ # compilation of Florist packages # ------------------------------------ # # "deps.adb" is dummy main program, with dependences # that should force compilation of all Florist packages; # "deps5c.adb" is the same, but with POSIX.5c packages added. # deps: Makefile $(ALL_SOURCES) florist gnatmake -c $(GNATMAKEFLAGS1B) $@ $(GNATMAKEFLAGS2B) deps_no_thread: Makefile $(ALL_SOURCES) florist gnatmake -c $(GNATMAKEFLAGS1B) $@ $(GNATMAKEFLAGS2B) deps5c: Makefile $(ALL_SOURCES) florist gnatmake -c $(GNATMAKEFLAGS1B) $@ $(GNATMAKEFLAGS2B) # # If we have modified the Ada runtime system, we need to recompile that also. # build: Makefile build.adb $(ALL_SOURCES) florist gnatmake -c $(GNATMAKEFLAGS1B) $@ $(GNATMAKEFLAGS2B) # # ----------------------------------- # Create a florist library for objects # ----------------------------------- # floristlib: $(MACRO_OBJECTS) $(DEPS) $(ADDRINFO_OBJECTS) $(FLORIST_SOURCES) @echo "Creating libflorist.a in directory floristlib" @if [ -d floristlib ]; then rm -rf floristlib; fi mkdir floristlib cp -p *.ads floristlib cp -p *.adb floristlib (tar cpf - *.o *.ali) | (cd floristlib; tar xpf -) rm -f floristlib/$(DEPS).o floristlib/$(DEPS).ali ar -r floristlib/libflorist.a floristlib/*.o chmod 444 floristlib/*.ali rm -f floristlib/*.o # # --------- # Testing # --------- # compile_tests: cd tests; make tests run_tests: cd tests; make run_tests # # ----------------------------------- # Maintenance targets # ----------------------------------- # # remove all c-posix and gnatprep generated files regen: rm -f $(C-POSIX_GENERATED) $(GNATPREP_GENERATED) # remove editor and compiler generated files clean: rm -rf floristlib rm -f *.o *.ali a.out *# *~ $(EXECUTABLES) b_*.c rm -f *CHECKING_IN* rm -f $(GNATPREP_GENERATED) $(C-POSIX_GENERATED) touch florist -make -C tests clean # remove all generated files, including configuration history realclean: rm -f $(CONFIG_HISTORY) $(CONFIG_GENERATED) rm -rf floristlib rm -f *.o *.ali a.out *# *~ $(EXECUTABLES) b_*.c rm -f *CHECKING_IN* rm -f $(GNATPREP_GENERATED) $(C-POSIX_GENERATED) touch florist -make -C tests clean # # The following targets are only for use by the implementors. # # check all sources into RCS directory # and remove everything except "Makefile" checkin: rm -f *.o *.ali $(EXECUTABLES) a.out *# *~ b_*.c $(GENERATED)\ $(CONFIG_HISTORY) rm -f *CHECKING_IN* -checkin $(FLORIST_SOURCES) $(DEBUG_SOURCES) $(TOOLS) $(DOCS) -checkout Makefile touch florist -make -C tests distclean # check out all sources, ready for editing neat: -checkout $(FLORIST_SOURCES) $(DEBUG_SOURCES) $(TOOLS) $(DOCS) cd tests; make neat touch florist # check out all sources, read-only checkallout: -checkout $(FLORIST_SOURCES) $(DEBUG_SOURCES) $(TOOLS) $(DOCS) rm -f $(GENERATED) touch florist cd tests; make checkallout # make subdirectory with links to files in manifest links: make_links MANIFEST ./make_links ./links # make links from current directory to master directory # so that we can compile and test current master versions devlinks: @if echo `pwd` | grep $(MASTERDIR) > /dev/null; then\ echo "devlinks should not be made in master directory";\ exit -1; fi $(MASTERDIR)/make_links . $(MASTERDIR) ln -s ${MASTERDIR}/configs/RCS ./configs/RCS ln -s ${MASTERDIR}/tests/RCS ./tests/RCS ln -s ${MASTERDIR}/tests/sockets/RCS ./tests/sockets/RCS ln -s ${MASTERDIR}/tests/xti/RCS ./tests/xti/RCS # make tar-file for normal Florist distribution distribution: $(FLORIST_SOURCES) $(DEBUG_SOURCES) $(TOOLS) $(DOCS) touch florist_sources rm -f ${FLORIST_VERSION}.tar.gz ./make_links ./${FLORIST_VERSION} $(MASTERDIR) tar cvhf ${FLORIST_VERSION}.tar ${FLORIST_VERSION} gzip ${FLORIST_VERSION}.tar # #