[makefile] more makefile cleaning and dynamic loading

This commit is contained in:
Gautier Hattenberger
2013-02-22 10:24:41 +01:00
committed by Felix Ruess
parent b81ae24917
commit 446231949b
6 changed files with 73 additions and 76 deletions
+5 -1
View File
@@ -57,6 +57,7 @@ MULTIMON=sw/ground_segment/multimon
COCKPIT=sw/ground_segment/cockpit
TMTC=sw/ground_segment/tmtc
TOOLS=$(PAPARAZZI_SRC)/sw/tools
JOYSTICK=sw/ground_segment/joystick
EXT=sw/ext
#
@@ -113,7 +114,7 @@ conf/%.xml :conf/%.xml.example
ground_segment: print_build_version update_google_version conf lib subdirs commands static
static: cockpit tmtc tools sim_static static_h
static: cockpit tmtc tools sim_static joystick static_h
lib:
$(MAKE) -C $(LIB)/ocaml
@@ -130,6 +131,9 @@ tmtc: lib cockpit multimon
tools: lib
$(MAKE) -C $(TOOLS)
joystick: lib
$(MAKE) -C $(JOYSTICK)
sim_static: lib
$(MAKE) -C $(SIMULATOR)
+3 -2
View File
@@ -36,7 +36,7 @@ FPIC=-fPIC
include ../../Makefile.ocaml
INCLUDES=
LIBS= lablglade.cma lib-pprz.cma lablgnomecanvas.cma xlib-pprz.cma
LIBS= lablglade.cma lablgnomecanvas.cma $(OCAMLDLL) $(LIBPPRZCMA) $(OCAMLXDLL) $(XLIBPPRZCMA)
CMXA=$(LIBS:.cma=.cmxa)
INCLUDES= -I $(LIBPPRZDIR) -I ../multimon
@@ -85,7 +85,8 @@ gtk_save_settings.ml : gcs.glade
strip.cmo : gtk_strip.cmo gtk_setting_time.cmo
compass : compass.ml
$(OCAMLC) -custom $(OCAMLCFLAGS) $(INCLUDES) unix.cma str.cma xml-light.cma $(LIBS) gtkInit.cmo $^ -o $@
@echo OL $@
$(Q)$(OCAMLFIND) $(OCAMLC) $(OCAMLCFLAGS) $(INCLUDES) -package $(PKGCOMMON) -linkpkg $(LIBS) gtkInit.cmo $^ -o $@
clean:
+9 -6
View File
@@ -27,13 +27,14 @@ Q=@
include ../../Makefile.ocaml
TOOLSDIR = ../../tools
OCAMLINCLUDES= -I $(LIBPPRZDIR) $(shell ocamlfind query -r -i-format lablgtk2) $(shell ocamlfind query -r -i-format xml-light) -I $(TOOLSDIR)
OCAMLINCLUDES= -I $(LIBPPRZDIR) -I $(TOOLSDIR)
#OCAMLINCLUDES= -I $(LIBPPRZDIR) $(shell ocamlfind query -r -i-format lablgtk2) $(shell ocamlfind query -r -i-format xml-light) $(shell ocamlfind query -r -i-format ivy) -I $(TOOLSDIR)
PKGCOMMON=unix,str,lablgtk2,ivy,xml-light
LIBPPRZCMA=$(LIBPPRZDIR)/lib-pprz.cma
# apparently on OSX `sdl-config --libs` also has -lSDLmain which we don't want
#ML_SDL_LFLAGS = $(foreach u,$(shell sdl-config --libs),-cclib $(u))
ML_SDL_LFLAGS = $(foreach u,$(shell pkg-config sdl --libs-only-L) -lSDL,-cclib $(u))
ML_SDL_LFLAGS = $(foreach u,$(shell pkg-config sdl --libs-only-L) -lSDL,-cclib $(u)) libSDL.so
INCLUDES += -I `ocamlc -where`
all: test_stick input2ivy
@@ -41,20 +42,22 @@ all: test_stick input2ivy
test_stick: test_sdl_stick.o
gcc -g -O2 -Wall -DSTICK_DBG `pkg-config glib-2.0 --cflags` -o $@ $^ sdl_stick.c `pkg-config glib-2.0 --libs` -lglibivy `sdl-config --libs`
input2ivy: sdl_stick.o ml_sdl_stick.o input2ivy.cmo
input2ivy: sdl_stick.so input2ivy.cmo
@echo OL $@
$(Q)$(OCAMLC) -make-runtime -o i2i_run sdl_stick.o ml_sdl_stick.o $(ML_SDL_LFLAGS)
$(Q)$(OCAMLFIND) $(OCAMLC) $(OCAMLINCLUDES) -use-runtime i2i_run -o $@ -package $(PKGCOMMON) -linkpkg $(OCAMLDLL) $(LIBPPRZCMA) $(TOOLSDIR)/fp_proc.cmo
$(Q)$(OCAMLFIND) $(OCAMLC) $(OCAMLINCLUDES) -o $@ -package $(PKGCOMMON) -linkpkg $(LIBPPRZCMA) $(TOOLSDIR)/fp_proc.cmo $^ $(ML_SDL_LFLAGS)
# dependency of input2ivy
input2ivy: $(LIBPPRZCMA) $(TOOLSDIR)/fp_proc.cmo
sdl_stick.so : sdl_stick.o ml_sdl_stick.o
gcc -shared -o $@ $^
%.o : %.c
gcc -c -O2 -Wall `pkg-config glib-2.0 --cflags` $(INCLUDES) $<
%.cmo : %.ml
@echo OC $<
$(Q)$(OCAMLC) $(OCAMLINCLUDES) -c $<
$(Q)$(OCAMLFIND) $(OCAMLC) $(OCAMLINCLUDES) -c -package $(PKGCOMMON) $<
clean:
rm -f *~ core *.o *.bak .depend test*stick *.cmo *.cmi input2ivy
+7 -10
View File
@@ -37,7 +37,8 @@ CPP =$(CC) -E
AR=ar
STRIP=strip
MKDIR=mkdir
OCAMLC =ocamlc
include ../../Makefile.ocaml
CFLAGS=-Wall -Wstrict-prototypes -I/usr/X11R6/include -I`$(OCAMLC) -where`
ifeq ($(DEBUG),y)
@@ -59,10 +60,6 @@ LDFLAGSX =-lX11 -L/usr/X11R6/lib
BINDIR =.
UNAME = $(shell uname -s)
ifeq ("$(UNAME)","Linux")
OBJFILES=pprzlib.o hdlc.o demod_afsk12.o demodml.o costabi.o gen_hdlc.o ml_hdlc.o demod.cmo hdlc.cmo
ALLTARGETS=$(BINDIR)/multimon multimon.cma
endif
ifeq ("$(UNAME)","linux")
OBJFILES=pprzlib.o hdlc.o demod_afsk12.o demodml.o costabi.o gen_hdlc.o ml_hdlc.o demod.cmo hdlc.cmo
ALLTARGETS=$(BINDIR)/multimon multimon.cma
@@ -133,11 +130,11 @@ hdlc.cmo : hdlc.cmi
$(OCAMLC) $<
clean:
rm -fr *.cm* mkcostab .depend
$(RM) -f core `find . -name '*.[oas]' -print`
$(RM) -f core `find . -name 'core' -print`
$(RM) -f core costabi.c costabf.c *~
$(RM) $(BINDIR)/multimon
$(Q)rm -fr *.cm* mkcostab .depend
$(Q)$(RM) -f core `find . -name '*.[oas]' -print`
$(Q)$(RM) -f core `find . -name 'core' -print`
$(Q)$(RM) -f core costabi.c costabf.c *~
$(Q)$(RM) $(BINDIR)/multimon
.PHONY: all clean depend dep
+9 -17
View File
@@ -30,6 +30,10 @@ else
endif
include ../../conf/Makefile.local
include ../Makefile.ocaml
OCAMLC += -g
PKGCOMMON=unix,str,lablgtk2,ivy,xml-light
SIMML = stdlib.ml data.ml flightModel.ml gps.ml
SIMHML = $(SIMML) hitl.ml sim.ml
@@ -38,31 +42,19 @@ SIMSML = $(SIMML) sitl.ml sim.ml
SIMSCMO=$(SIMSML:%.ml=%.cmo)
SIMSCMX=$(SIMSML:%.ml=%.cmx)
OCAMLC = ocamlc -g
OCAMLOPT = ocamlopt
OCAMLDEP = ocamldep
OCAMLFIND = ocamlfind
OCAML=$(shell which ocaml)
OCAMLRUN=$(shell which ocamlrun)
LIBPPRZDIR=../lib/ocaml
INCLUDES= -I $(LIBPPRZDIR)
LIBPPRZCMA=$(LIBPPRZDIR)/lib-pprz.cma
PKGCOMMON=unix,str,lablgtk2,ivy,xml-light
AIRBORNE = ../airborne
VARINCLUDE=$(PAPARAZZI_HOME)/var/include
ACINCLUDE = $(PAPARAZZI_HOME)/var/$(AIRCRAFT)
all : gaia sitl.cma
all : gaia sitl.cma simhitl
#simhitl
fg.so : fg.o
gcc -shared -o $@ $^
simhitl : fg.o $(SIMHCMO) simhitl.cmo
simhitl : fg.so $(SIMHCMO) simhitl.cmo
@echo OL $@
$(Q)$(OCAMLFIND) $(OCAMLC) -make-runtime -o simhitl_run fg.o
$(Q)$(OCAMLFIND) $(OCAMLC) $(INCLUDES) -use-runtime simhitl_run -o $@ -package $(PKGCOMMON) -linkpkg lib-pprz.cma gtkInit.cmo $^
$(Q)$(OCAMLFIND) $(OCAMLC) $(INCLUDES) -o $@ -package $(PKGCOMMON) -linkpkg lib-pprz.cma gtkInit.cmo $<
sitl.cma : fg.o $(SIMSCMO)
@echo OL $@