The paper concerns an optimal control approach to continuous-time aggregate production planning in make-to-stock and make-to-order environments. The dynamics of such a production system are modelled by purchased, in-process and finished inventory flows through multiple facilities of finite capacity. The objective of the make-to-order production is to track a given customer demand as closely as possible, while in the make-to-stock production it is to keep the purchased inventory minimal when filling the stocks with volumes of products scheduled to be completed by the end of the planning horizon. The optimal behaviour of the system is studied with the aid of the maximum principle which allows new analytical results to be derived. Consequently, fast numerical and analytical algorithms for balancing facilities in the two corresponding environments are suggested.