Commit 873890bd authored by Jeroen Vreeken's avatar Jeroen Vreeken
Browse files

Move console to new build

parent 4b8f214d
......@@ -5,9 +5,7 @@ include build.mk
CONTROLLER_REL_TAR:=$(CURDIR)/controller_$(shell date +%Y%m%d%H%M).tar.gz
CONSOLE_REL_TAR:=$(CURDIR)/console_$(shell date +%Y%m%d%H%M).tar.gz
all: subdirs
cd libnova-0.13.0 ; ./configure -enable-static -disable-shared --prefix=${CURDIR} ; make; make install
$(MAKE) -C console
all: common controller console
help:
@echo "Available build rules"; \
......@@ -31,16 +29,13 @@ help:
echo "golden repository (on eris.camras.nl)."
controller: subdirs
console: subdirs
libnova.la:
cd libnova-0.13.0 ; ./configure -enable-static -disable-shared --prefix=${CURDIR} ; make; make install
$(MAKE) -C console
clean: subdirs_CLEAN
rm -rf common/lib/*
cd libnova-0.13.0 ; make clean || true
$(MAKE) -C console clean
# Rules for building a release
......@@ -121,14 +116,22 @@ include $(DIR)/$1/build.mk
DIR := $(DIR)
endef
TARGETS:=
$(eval $(call SUBDIR,common))
common: $(TARGETS)
TARGETS:=
$(eval $(call SUBDIR,controller))
controller: $(TARGETS)
TARGETS:=
$(eval $(call SUBDIR,console))
console: $(TARGETS)
CFLAGS := -Icommon -Icommon/include -Icontroller
LDFLAGS := -Lcommon/lib -Lcontroller/lib
VPATH += common/lib controller/lib
CFLAGS := -Icommon -Icommon/include -Icontroller -Iconsole/console -Iinclude
LDFLAGS := -Lcommon/lib -Lcontroller/lib -Lconsole/console/lib -Llib
VPATH += common/lib controller/lib console/console/lib lib
subdirs: $(TARGETS)
SRCS_TMP=$(SRCS:.il=.il.d)
-include $(SRCS_TMP:.c=.d) $(patsubst %.c,.libs/%.d,$(SRCS_TMP))
......
......@@ -46,6 +46,10 @@ define LIB_LINK
@${LIBTOOL} --quiet --mode=install install $@ $(abspath $(@D))
endef
%.so:
@echo "LT soLD $@"
@${LIBTOOL} --quiet --mode=link gcc $(filter %.lo,$^) -o $@ $(LDFLAGS) $($@_LDFLAGS)
(%): %
@echo " AR $^ in $@"
@$(AR) $(ARFLAGS) $@ $^
......
include build.mk
CFLAGS= -Wall -O3 \
-I. \
-Icontroller \
-I../common/utils \
-I../common/trace \
-I../common/include \
-Idt_azimuth -Idt_elevation -Iec -Ishell -Ilog
LDFLAGS= -lpthread -lrt -lm -ldl -Wl,-E
CFLAGS_SIM=-DUSE_AZ_SIM -DUSE_EL_SIM
ARCHIVES= \
dt_azimuth/dt_azimuth.a \
dt_elevation/dt_elevation.a \
controller/controller.a \
log/log.a \
ec/ec.a \
shell/shell.a \
../common/trace/trace.a \
../common/utils/utils.a
dt_ctrl_sim_LDFLAGS=`controller/block_list.sh dt_azimuth/dt_azimuth.a dt_elevation/dt_elevation.a controller/controller.a`
dt_ctrl_LDFLAGS=$(dt_ctrl_sim_LDFLAGS) `controller/block_list.sh ec/ec.a`
all: console htdocs/console_version.js
htdocs/console_version.js:
@echo "document.write('CAMRAS Console <a target="_blank" href=\"https://eris.camras.nl/redmine/projects/console/repository/revisions/` git rev-parse HEAD`\">built at `date \"+%F %R %Z\"` by ${USER} on `hostname -f`</a>');" > $@
%.a:
@echo " SUBDIR: $(@D)"
@$(MAKE) -C $(@D)
winrotor-usb:
@echo " SUBDIR: $@"
@$(MAKE) -C winrotor-usb
console:
@echo " SUBDIR: $@"
@$(MAKE) -C console
.PHONY: console htdocs/console_version.js
clean:
rm -f *.o *.d
$(MAKE) -C console clean
$(MAKE) -C winrotor-usb clean
# Some make rules to make output pretty....
# default ARFLAGS also has 'v', but we don't want it to be verbose.
ARFLAGS= -r
# make sure libs from /usr/local/lib are found
VPATH= /lib64 /usr/lib64 /usr/local/lib64 /lib /usr/lib /usr/local/lib
LIBTOOL=libtool
%.o : %.c
@echo " CC $<"
@$(CC) -MMD $(CFLAGS) $($@_CFLAGS) -c $<
%: %.o
@echo " LD $@"
@${LIBTOOL} --quiet --mode=link --tag=CC $(LINK.o) $(filter %.o,$^) $(LOADLIBS) $(LDLIBS) $($@_LDFLAGS) -o $@
%.lo: %.c
@echo "LT CC $<"
@${LIBTOOL} --quiet --mode=compile --tag=CC $(CC) -MMD $(CFLAGS) $($@_CFLAGS) -c $<
%.la:
@echo "LIBTOOL $@"
@${LIBTOOL} --quiet --mode=link gcc $^ -o $@ $(LDFLAGS) $($@_LDFLAGS) -static-libtool-libs
%.so:
@echo "LIBTOOL $@"
@${LIBTOOL} --quiet --mode=link gcc $^ -o $*.la $(LDFLAGS) $($@_LDFLAGS)
@cp .libs/$*.so .
(%): %
@echo " AR $^ in $@"
@$(AR) $(ARFLAGS) $@ $^
%.tab.c %.tab.h: %.y
@echo "BISON $<"
@bison -d $<
%.yy.h: %.l %.tab.h
@echo " FLEX $<"
@flex --header-file=$*.yy.h $<
%.yy.c: %.l %.tab.h
@echo " FLEX $<"
@flex -o $@ $<
# il2c: instruction list 2 c 'compiler'
%.c %.h: %.il
@echo " IL2C $<"
@$(IL2C) $<
# dot -> pdf
%.pdf: %.dot
@echo " DOT $<"
@dot $< -o $@ -Tpdf
-include $(SRCS:.c=.d)
$(eval $(call SUBDIR,console))
include ../build.mk
CFLAGS= -Wall -O3 -I../../common/utils \
-I../controller \
-Iaalib -Ipredictlib \
-I../../common/trace \
-I../../common/include \
-I../../common/log \
-I../../include \
-I../../common
LDFLAGS+= -L../../common/lib/ -L../../lib/ -L./lib -lutils -ltrace -llog
LIBNOVA=-lnova -L../../lib/
RELEASE_FILE=../../release/console.tar.gz
all: lib/libaa.la lib/libpredict.la \
console_joystick command_shell \
console_moontracker \
trace_proxy trace_log \
console_j2000tracker console_j2000tracer console_j2000_indi \
log_proxy spg_auth console_idle \
console_suntracker console_azel console_manual \
console_weather console_dt_model \
await_controller \
console_sattracker \
mod_websocket_dt/mod_websocket_dt.so \
$(RELEASE_FILE): all
tar -C $(@D) -zhcvf $@ console
release: $(RELEASE_FILE)
await_controller: await_controller.o
console_joystick_LDFLAGS= -lcommand
console_joystick: console_joystick.o
command_shell_LDFLAGS= -lcommand
command_shell: command_shell.o
console_moontracker_LDFLAGS= -lm -lpthread -laa -lcommand
console_moontracker: console_moontracker.o lib/libaa.la
console_j2000tracker_LDFLAGS=$(LIBNOVA) -lpthread -lm -lcommand
console_j2000tracker: console_j2000tracker.o
console_j2000tracer_LDFLAGS=$(LIBNOVA) -lm
console_j2000tracer: console_j2000tracer.o
console_j2000_indi_LDFLAGS= -lindi -lindidriver -lm $(LIBNOVA)
console_j2000_indi: console_j2000_indi.o
console_azel_LDFLAGS= -lcommand
console_azel: console_azel.o
console_manual_LDFLAGS= -lcommand
console_manual: console_manual.o
console_suntracker_LDFLAGS= -lm -lpthread -laa -lcommand
console_suntracker: console_suntracker.o lib/libaa.la
console_idle_LDFLAGS= -lcommand
console_idle: console_idle.o
console_weather_LDFLAGS= -lpthread
console_weather: console_weather.o
console_dt_model.o_CFLAGS+=`pkg-config --cflags glib-2.0`
console_dt_model_LDFLAGS+=`pkg-config --libs glib-2.0`
console_dt_model: console_dt_model.o
trace_proxy: trace_proxy.o
trace_log: trace_log.o
log_proxy: log_proxy.o
spg_auth_LDFLAGS= -lcommand
spg_auth: spg_auth.o
console_sattracker_LDFLAGS= -lpthread $(LIBNOVA) -lm -lpredict -lcommand
console_sattracker: console_sattracker.o lib/libpredict.la
lib/libaa.la:
@$(MAKE) -C aalib
doc:
@$(MAKE) -C doc
lib/libpredict.la:
@$(MAKE) -C predictlib
mod_websocket_dt/mod_websocket_dt.so:
@$(MAKE) -C mod_websocket_dt
.PHONY: doc
clean:
rm -rf *.o *.d lib/* *.lo *.a *.la .libs
rm -f \
await_controller \
command_shell \
console_joystick \
console_dt_model \
console_manual \
console_moontracker \
console_suntracker \
console_j2000tracker \
console_j2000tracer \
console_j2000_indi \
console_azel \
console_idle \
console_sattracker \
console_weather \
log_proxy \
spg_auth \
trace_proxy \
trace_proxy \
trace_log
$(MAKE) -C aalib clean
$(MAKE) -C doc clean
$(MAKE) -C predictlib clean
$(MAKE) -C mod_websocket_dt clean
AALIB_TARGETS := $(LIBDIR)/libaa.la
AALIB_SRCS := \
$(DIR)/altaz.c \
$(DIR)/angles.c \
$(DIR)/annuab.c \
$(DIR)/constel.c \
$(DIR)/deflec.c \
$(DIR)/deltat.c \
$(DIR)/diurab.c \
$(DIR)/diurpx.c \
$(DIR)/dms.c \
$(DIR)/epsiln.c \
$(DIR)/fk4fk5.c \
$(DIR)/kepler.c \
$(DIR)/kfiles.c \
$(DIR)/lightt.c \
$(DIR)/lonlat.c \
$(DIR)/nutate.c \
$(DIR)/precess.c \
$(DIR)/refrac.c \
$(DIR)/rplanet.c \
$(DIR)/rstar.c \
$(DIR)/sidrlt.c \
$(DIR)/sun.c \
$(DIR)/domoon.c \
$(DIR)/trnsit.c \
$(DIR)/vearth.c \
$(DIR)/zatan2.c \
$(DIR)/gplan.c \
$(DIR)/mer404.c \
$(DIR)/ven404.c \
$(DIR)/ear404.c \
$(DIR)/mar404.c \
$(DIR)/jup404.c \
$(DIR)/sat404.c \
$(DIR)/ura404.c \
$(DIR)/nep404.c \
$(DIR)/plu404.c \
$(DIR)/mlr404.c \
$(DIR)/mlat404.c \
$(DIR)/aa.c
AALIB_OBJS := $(AALIB_SRCS:.c=.lo)
$(LIBDIR)/libaa.la: CFLAGS += -Wall -O2
$(LIBDIR)/libaa.la: LDFLAGS += -lm
$(LIBDIR)/libaa.la: $(AALIB_OBJS)
$(LIB_LINK)
SRCS += $(AALIB_SRCS)
TARGETS += $(AALIB_TARGETS)
CLEAN += $(AALIB_TARGETS) $(AALIB_OBJS)
......@@ -21,10 +21,10 @@
#include <string.h>
#include <unistd.h>
#include "tcp_connect.h"
#include <utils/tcp_connect.h>
#include "dt_port_numbers.h"
#include "dt_host.h"
#include <dt_port_numbers.h>
#include <utils/dt_host.h>
#define MAX_RETRIES 30
#define SLEEP_INTERVAL 10
......
LIBDIR:=$(DIR)/lib
$(eval $(call SUBDIR,aalib))
$(eval $(call SUBDIR,predictlib))
$(eval $(call SUBDIR,mod_websocket_dt))
CONSOLE_TARGETS :=
CONSOLE_TARGETS += $(DIR)/console_joystick
CONSOLE_TARGETS += $(DIR)/command_shell
CONSOLE_TARGETS += $(DIR)/console_moontracker
CONSOLE_TARGETS += $(DIR)/trace_proxy
CONSOLE_TARGETS += $(DIR)/trace_log
CONSOLE_TARGETS += $(DIR)/console_j2000tracker
CONSOLE_TARGETS += $(DIR)/console_j2000tracer
CONSOLE_TARGETS += $(DIR)/console_j2000_indi
CONSOLE_TARGETS += $(DIR)/log_proxy
CONSOLE_TARGETS += $(DIR)/spg_auth
CONSOLE_TARGETS += $(DIR)/console_idle
CONSOLE_TARGETS += $(DIR)/console_suntracker
CONSOLE_TARGETS += $(DIR)/console_azel
CONSOLE_TARGETS += $(DIR)/console_manual
CONSOLE_TARGETS += $(DIR)/console_weather
CONSOLE_TARGETS += $(DIR)/console_dt_model
CONSOLE_TARGETS += $(DIR)/await_controller
CONSOLE_TARGETS += $(DIR)/console_sattracker
#mod_websocket_dt/mod_websocket_dt.so
CONSOLE_SRCS :=
$(DIR)/await_controller: CFLAGS += -Wall -O3
$(DIR)/await_controller: LDFLAGS += -lutils
$(DIR)/await_controller: libutils.la
$(DIR)/await_controller: $(DIR)/await_controller.o
CONSOLE_SRCS += $(DIR)/await_controller.c
$(DIR)/console_joystick: CFLAGS += -Wall -O3
$(DIR)/console_joystick: LDFLAGS += -lcommand
$(DIR)/console_joystick: libcommand.la
$(DIR)/console_joystick: $(DIR)/console_joystick.o
CONSOLE_SRCS += $(DIR)/console_joystick.c
$(DIR)/command_shell: CFLAGS += -Wall -O3
$(DIR)/command_shell: LDFLAGS += -lcommand
$(DIR)/command_shell: libcommand.la
$(DIR)/command_shell: $(DIR)/command_shell.o
CONSOLE_SRCS += $(DIR)/command_shell.c
$(DIR)/console_moontracker: CFLAGS += -Wall -O3
$(DIR)/console_moontracker: LDFLAGS += -lcommand -lm -laa
$(DIR)/console_moontracker: libcommand.la libaa.la
$(DIR)/console_moontracker: $(DIR)/console_moontracker.o
CONSOLE_SRCS += $(DIR)/console_moontracker.c
$(DIR)/console_j2000tracker: CFLAGS += -Wall -O3
$(DIR)/console_j2000tracker: LDFLAGS += -lcommand -lm -lnova -ltrace
$(DIR)/console_j2000tracker: libcommand.la libtrace.la libnova.la
$(DIR)/console_j2000tracker: $(DIR)/console_j2000tracker.o
CONSOLE_SRCS += $(DIR)/console_j2000tracker.c
$(DIR)/console_j2000tracer: CFLAGS += -Wall -O3
$(DIR)/console_j2000tracer: LDFLAGS += -lm -lnova -lutils
$(DIR)/console_j2000tracer: libutils.la libnova.la
$(DIR)/console_j2000tracer: $(DIR)/console_j2000tracer.o
CONSOLE_SRCS += $(DIR)/console_j2000tracer.c
$(DIR)/console_j2000_indi: CFLAGS += -Wall -O3
$(DIR)/console_j2000_indi: LDFLAGS += -lm -lindi -lindidriver -lnova -lutils
$(DIR)/console_j2000_indi: libutils.la libnova.la
$(DIR)/console_j2000_indi: $(DIR)/console_j2000_indi.o
CONSOLE_SRCS += $(DIR)/console_j2000_indi.c
$(DIR)/console_azel: CFLAGS += -Wall -O3
$(DIR)/console_azel: LDFLAGS += -lcommand
$(DIR)/console_azel: libcommand.la
$(DIR)/console_azel: $(DIR)/console_azel.o
CONSOLE_SRCS += $(DIR)/console_azel.c
$(DIR)/console_manual: CFLAGS += -Wall -O3
$(DIR)/console_manual: LDFLAGS += -lcommand
$(DIR)/console_manual: libcommand.la
$(DIR)/console_manual: $(DIR)/console_manual.o
CONSOLE_SRCS += $(DIR)/console_manual.c
$(DIR)/console_suntracker: CFLAGS += -Wall -O3
$(DIR)/console_suntracker: LDFLAGS += -lcommand -lm -laa
$(DIR)/console_suntracker: libcommand.la libaa.la
$(DIR)/console_suntracker: $(DIR)/console_suntracker.o
CONSOLE_SRCS += $(DIR)/console_suntracker.c
$(DIR)/console_idle: CFLAGS += -Wall -O3
$(DIR)/console_idle: LDFLAGS += -lcommand
$(DIR)/console_idle: libcommand.la
$(DIR)/console_idle: $(DIR)/console_idle.o
CONSOLE_SRCS += $(DIR)/console_idle.c
$(DIR)/console_weather: CFLAGS += -Wall -O3
$(DIR)/console_weather: LDFLAGS += -lutils
$(DIR)/console_weather: libutils.la
$(DIR)/console_weather: $(DIR)/console_weather.o
CONSOLE_SRCS += $(DIR)/console_weather.c
$(DIR)/console_dt_model: CFLAGS += -Wall -O3 `pkg-config --cflags glib-2.0`
$(DIR)/console_dt_model: LDFLAGS += `pkg-config --libs glib-2.0` -llog -lutils
$(DIR)/console_dt_model: liblog.la libutils.la
$(DIR)/console_dt_model: $(DIR)/console_dt_model.o
CONSOLE_SRCS += $(DIR)/console_dt_model.c
$(DIR)/trace_proxy: CFLAGS += -Wall -O3
$(DIR)/trace_proxy: LDFLAGS += -ltrace
$(DIR)/trace_proxy: libtrace.la
$(DIR)/trace_proxy: $(DIR)/trace_proxy.o
CONSOLE_SRCS += $(DIR)/trace_proxy.c
$(DIR)/trace_log: CFLAGS += -Wall -O3
$(DIR)/trace_log: LDFLAGS += -lutils
$(DIR)/trace_log: libutils.la
$(DIR)/trace_log: $(DIR)/trace_log.o
CONSOLE_SRCS += $(DIR)/trace_log.c
$(DIR)/log_proxy: CFLAGS += -Wall -O3
$(DIR)/log_proxy: LDFLAGS += -llog
$(DIR)/log_proxy: liblog.la
$(DIR)/log_proxy: $(DIR)/log_proxy.o
CONSOLE_SRCS += $(DIR)/log_proxy.c
$(DIR)/spg_auth: CFLAGS += -Wall -O3
$(DIR)/spg_auth: LDFLAGS += -lcommand
$(DIR)/spg_auth: libcommand.la
$(DIR)/spg_auth: $(DIR)/spg_auth.o
CONSOLE_SRCS += $(DIR)/spg_auth.c
$(DIR)/console_sattracker: CFLAGS += -Wall -O3
$(DIR)/console_sattracker: LDFLAGS += -lcommand -lnova -lpredict
$(DIR)/console_sattracker: libcommand.la libpredict.la libnova.la
$(DIR)/console_sattracker: $(DIR)/console_sattracker.o
CONSOLE_SRCS += $(DIR)/console_sattracker.c
SRCS += $(CONSOLE_SRCS)
TARGETS += $(CONSOLE_TARGETS)
CLEAN += $(CONSOLE_TARGETS) $(CONSOLE_SRCS:.c=.o)
......@@ -38,10 +38,10 @@
#include <command/command.h>
#include <log/log.h>
#include "dt_port_numbers.h"
#include "dt_host.h"
#include <dt_port_numbers.h>
#include <utils/dt_host.h>
#include "command_server.h"
#include <utils/command_server.h>
char *command_host = "localhost";
int command_port = 11000;
......
......@@ -38,13 +38,13 @@
#include <stdbool.h>
#include <glib.h>
#include "dt_model.h"
#include <utils/dt_model.h>
#include "dt_port_numbers.h"
#include "dt_host.h"
#include "command_server.h"
#include "status_server.h"
#include "log.h"
#include <dt_port_numbers.h>
#include <utils/dt_host.h>
#include <utils/command_server.h>
#include <utils/status_server.h>
#include <log/log.h>
int stat_port = CONSOLE_DT_MODEL_STAT_PORT;
......
......@@ -28,7 +28,7 @@
#include <fcntl.h>
#include <sys/ioctl.h>
#include "tcp_connect.h"
#include <utils/tcp_connect.h>
#define mydev "Dwingeloo Radio Telescope"
#define BASIC_GROUP "Main Control"
......
......@@ -40,8 +40,8 @@
#include <libnova/julian_day.h>
#include <libnova/utility.h>
#include "tcp_connect.h"
#include "tcp_listen.h"
#include <utils/tcp_connect.h>
#include <utils/tcp_listen.h>
#define SKIP_TIME 10
......
......@@ -46,14 +46,14 @@
#include <command/command.h>
#include "weather.h"
#include "dt_model.h"
#include "trace.h"
#include "dt_port_numbers.h"
#include "command_server.h"
#include "status_server.h"
#include "dt_host.h"
#include "log.h"
#include <utils/weather.h>
#include <utils/dt_model.h>
#include <trace/trace.h>
#include <dt_port_numbers.h>
#include <utils/command_server.h>
#include <utils/status_server.h>
#include <utils/dt_host.h>
#include <log/log.h>
#define TIME_OFFSET 2
......
......@@ -34,7 +34,7 @@
#include <fcntl.h>
#include <linux/joystick.h>
#include <config.h>
#include <utils/config.h>
#include <command/command.h>
......
......@@ -38,7 +38,7 @@
#include <command/command.h>
#include "command_server.h"
#include <utils/command_server.h>
char *command_host = "localhost";
int command_port = 11000;
......
......@@ -42,15 +42,15 @@
#include <command/command.h>
#include "aalib.h"
#include "weather.h"
#include "dt_model.h"
#include "dt_port_numbers.h"